feat(components): freeze tab widths during rapid closes like Chromium - #805
Merged
Merged
Conversation
A pointer-triggered close freezes every surviving tab at its current width (Chromium in_tab_close_ / override_available_width_for_tabs_) so the next close button stays under the cursor. The freeze releases when the pointer leaves an expanded region (40px below the strip, 60px toward the new-tab button), on a tab add, on a viewport shrink below the captured width, or when a single tab remains; closing the last tab while frozen re-spreads survivors over the occupied width. Widths freeze by role: a survivor promoted to active takes the captured active width and widens in place without the removal slide. Removals slide closed and inserts grow in over a 200ms transition; a same-commit remove+add morphs from the removed width instead of zero, and a lone tab in an empty strip renders directly. The removal diff runs during render (derived-state adjustment), so the first painted frame of a removal already carries frozen widths — an earlier effect-driven freeze let the unfrozen allocation commit first and flashed survivors at the fresh width. Model: swe-2-max Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: wibus-wee <62133302+wibus-wee@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Chromium's rapid-close mode (
in_tab_close_/override_available_width_for_tabs_) inAdaptiveTabStrip, so closing a tab keeps every survivor at its current width and the next close button lands under the cursor — matching Chrome's behavior during repeated closes.pointerdowninside the strip arms the gesture (≈CloseTabSource::kFromMouse); keyboard/programmatic closes relayout normally.min(override, real)), or when a single tab remains. Closing the last tab while frozen re-spreads survivors over the occupied width, keeping the new last tab's close button under the cursor.size_delta = next_active_tab->width()), and widens in place without the removal slide so it cannot read as unfolding from the emptied slot.margin-inline-start; pure inserts grow from zero (StartInsertTabAnimation); a same-commit remove+add morphs from the removed width (draft→session promotion); a lone tab in an empty strip renders directly.useLayoutEffect-driven freeze let the unfrozen allocation commit first and flashed survivors at the fresh width for a frame.Rapid Closestory is now fully interactive (close/select/reorder/new-tab/restore against local state) and selects the same neighbour as production'sgetSessionTabFallback.Test plan
tests/session-tab-bar.test.tsxrapid-close suite — 24/24 pass: freeze, slop boundaries, consecutive closes, slide margins, trailing-close re-spread, single-survivor release, viewport grow/shrink, unarmed close, active-close promotion, substitution morph, empty-strip insert, and a MutationObserver regression asserting the active item never holds an unfrozen width on the removal committests/adaptive-tab-strip.test.ts— 7/7 passSessions/SessionTabBar → Rapid Close): freeze, slop region, trailing-close re-spread, margin/width CSSTransitions viadocument.getAnimations(), and per-mutation style sequences showing no unfrozen widthGenerated with Devin