Repository navigation
fix(app): keep tab widths while closing tabs with the mouse - #66887
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
The fix looks sound. I reproduced the bug on dev with the new e2e case: after the first mouse close, nothing is under the pointer. With this PR the full side-panels.spec.ts passes (11/11), tsc -b is clean for packages/app, and the runtime/plugin unit tests pass.
The pinned widths are cleared on pointer leave, on tab add or move, and when the strip changes any other way, so the strip is unchanged outside the close-with-the-mouse sequence.
Public API: unchanged (internal to packages/app).
This is a visible UI change in the web app, so the before/after recordings mentioned in the description would be good to attach.
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.
Issue for this PR
Closes # (no issue)
Type of change
What does this PR do?
You can now close side panel tabs one after another without moving the mouse, as in Chrome. After a mouse close, while the pointer stays on the strip, the other tabs keep their width, so the next tab's X slides under the pointer. Closing the last tab lets the tabs before it fill its place, so the new last tab's X lands under the pointer. When the pointer leaves the strip, the tabs fill it again.
packages/app/src/runtime/plugin/tab-strip-widths.tsholds the strip, the way Chrome holds its available width. On a mouse click on a close button (or a middle click on a tab), it measures the closing tab. Once that tab is removed, it setspadding-inline-endon the strip to the closed tab plus one gap. Closing the last tab leaves the padding as it is. Flex layout then keeps every tab, short or long, at its width, and the "+" stays right after the last tab.The hold is released when:
A click that closes nothing (such as a middle click on a pinned tab) holds nothing. Touch and pen never hold, because they leave the strip before their click. An overflowing strip scrolls instead of resizing, so it is never held. Outside the hold the strip has no inline style, so it looks the same as before.
No feature flag: it's a bug fix.
How did you verify your code works?
Component tests (
packages/app/component-tests/tab-strip-widths.spec.ts, a fixture with the real tab styles and close buttons). They cover:All 6 fail or pass as expected against dev and against this PR's first version; 15 repeats, 90/90 pass.
e2e
side-panels.spec.tscase in the real app: it closes a middle tab and then the last tab, next to a short tab, then leaves the strip. It fails on dev. Built mode, 3 repeats with 5 workers: 33/33 pass.bun typecheck(app),bun run lint:changed origin/dev, prettier on new files.Screenshots / recordings
Playwright recordings of clicking X with the mouse held still, on a mix of short and long tabs: before (dev) and after. They're saved locally as
tab-close-width-before.mp4andtab-close-width-after.mp4, and can be dropped in here.Checklist