Skip to content

fix(app): keep tab widths while closing tabs with the mouse - #66887

Merged
rekram1-node merged 2 commits into
devfrom
tab-close-width
Nov 27, 2026
Merged

rekram1-node merged 2 commits into
devfrom
tab-close-width

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes # (no issue)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

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.

before: [a x][b x][c x][d x]   click c's x  ->  [a  x][b  x][d  x]      d's x moved right, the pointer misses it
after:  [a x][b x][c x][d x]   click c's x  ->  [a x][b x][d x]___      d's x is under the pointer (___ = hold)
                                pointer leaves  ->  [a  x][b  x][d  x]

packages/app/src/runtime/plugin/tab-strip-widths.ts holds 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 sets padding-inline-end on 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:

  • the pointer leaves the strip, the window loses focus, or the pointer is cancelled
  • the strip's own width changes
  • a tab is added or moved
  • a tab is closed from the keyboard or elsewhere

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:

    • a mouse close with short and long tabs, then closing the last tab: the next X is under the pointer, the "+" is one gap after the last tab, and there's no end fade
    • a middle-click close, and the strip being resized while held
    • keyboard closes, and a middle click that closes nothing
    • right-to-left
    • an overflowing strip
    • touch

    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.ts case 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.mp4 and tab-close-width-after.mp4, and can be dropped in here.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rekram1-node
rekram1-node enabled auto-merge (squash) November 27, 2026 22:01
@rekram1-node
rekram1-node merged commit 36bfb85 into dev Nov 27, 2026
12 checks passed
@rekram1-node
rekram1-node deleted the tab-close-width branch November 27, 2026 22:01
@amrkmn amrkmn mentioned this pull request Nov 30, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant