Skip to content

fix(Tabs): keep rename input mounted when triggered from tab menu#1176

Merged
tenphi merged 4 commits into
mainfrom
fix-tabs-rename
May 19, 2026
Merged

fix(Tabs): keep rename input mounted when triggered from tab menu#1176
tenphi merged 4 commits into
mainfrom
fix-tabs-rename

Conversation

@tenphi
Copy link
Copy Markdown
Member

@tenphi tenphi commented May 19, 2026

Previously, clicking "Rename" in a tab's menu mounted the inline-edit input only to have it stolen-focus + committed-out by the closing Menu popover's <FocusScope restoreFocus> ~350ms later. The user saw the menu close and nothing else happened.

InlineInput now ignores blurs within ~500ms of a programmatic startEditing() call (cleared on the first user keystroke). TabButton also retries focusing the input across the menu's exit transition as a belt-and-suspenders defense.


Note

Medium Risk
Touches focus/blur-driven commit behavior in InlineInput, so timing-based guardrails could affect other consumers relying on submitOnBlur semantics; changes are well-covered by new regression tests.

Overview
Fixes a Tabs rename regression where selecting Rename from the tab menu could immediately blur, trigger submitOnBlur, and unmount the editor.

InlineInput now applies a ~500ms grace period after an imperative startEditing() where an immediate blur re-focuses/selects the input instead of committing, and TabButton adds a short refocus retry loop during the menu exit transition to keep the rename input focused (including contextMenu="context-only" cases).

Adds targeted regression tests for the focus-theft scenario, tweaks a Dialog story play step to wait for menu close/transition stability, and slightly adjusts the surface-4 palette saturation.

Reviewed by Cursor Bugbot for commit c17349a. Bugbot is set up for automated code reviews on this repo. Configure here.

Previously, clicking "Rename" in a tab's menu mounted the inline-edit
input only to have it stolen-focus + committed-out by the closing Menu
popover's `<FocusScope restoreFocus>` ~350ms later. The user saw the
menu close and nothing else happened.

InlineInput now ignores blurs within ~500ms of a programmatic
`startEditing()` call (cleared on the first user keystroke). TabButton
also retries focusing the input across the menu's exit transition as a
belt-and-suspenders defense.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cube-ui-kit Ready Ready Preview, Comment May 19, 2026 9:29am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

🦋 Changeset detected

Latest commit: c17349a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

📦 NPM canary release

Deployed canary version 0.0.0-canary-844aa2d.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

🏋️ Size limit report

Name Size Passed?
All 393.96 KB (+0.06% 🔺) Yes 🎉
Tree shaking (just a Button) 112.47 KB (0% 🟰) Yes 🎉

Click here if you want to find out what is changed in this build

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

🧪 Storybook is successfully deployed!

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3a27996. Configure here.

Comment thread src/components/navigation/Tabs/TabButton.tsx
Comment thread src/tokens/palette.ts
…s in all menu modes

scheduleRenameRefocus previously queried containerRef and actionsRef,
but `containerRef` is shadowed by `contextMenu.targetRef` when context
menu is enabled and `actionsRef` is never attached for
`contextMenu="context-only"` tabs without delete handlers or custom
actions. The refocus loop became a silent no-op in that configuration.

Switch to the tab button ref (`<TabElement>`) — which is always wired
up and contains the InlineInput — and add a regression test for the
context-only no-actions path.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tenphi tenphi merged commit 80a4492 into main May 19, 2026
16 checks passed
@tenphi tenphi deleted the fix-tabs-rename branch May 19, 2026 09:35
@github-actions github-actions Bot mentioned this pull request May 19, 2026
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