Skip to content

feat: replace tab right-click close with hover × close button#691

Open
derrick4reals wants to merge 4 commits into
YishenTu:mainfrom
derrick4reals:feat/tab-close-hover
Open

feat: replace tab right-click close with hover × close button#691
derrick4reals wants to merge 4 commits into
YishenTu:mainfrom
derrick4reals:feat/tab-close-hover

Conversation

@derrick4reals

@derrick4reals derrick4reals commented May 25, 2026

Copy link
Copy Markdown

Summary

  • Replace right-click (contextmenu) tab close with a visible × button on badge hover
  • Close button appears on hover, clicks are isolated with stopPropagation/stopImmediatePropagation
  • Adds aria-label="Close tab" for accessibility

Changes

  • TabBar.renderBadge() now renders a × div instead of listening for contextmenu
  • CSS: close button hidden by default, absolutely positioned, shown on badge hover

Test Plan

  • Unit tests for close button rendering, canClose gating, click callback
  • Manual: open 2+ tabs, hover over a tab badge, click × to close

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fee9e8fc08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 69 to +70
if (item.canClose) {
badgeEl.addEventListener('contextmenu', (e) => {
const closeEl = badgeEl.createDiv({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Hide close affordance when tab cannot actually close

Rendering the new × control whenever item.canClose is true exposes a clickable close action that can be a guaranteed no-op for users: in a single blank tab state, getTabBarItems() still sets canClose true, but TabManager.closeTab() immediately returns false for the lone empty tab (src/features/chat/tabs/TabManager.ts:317). With this commit, that mismatch becomes visible as a broken affordance (hover × appears, click does nothing), so the close button should only render when the tab is truly closable.

Useful? React with 👍 / 👎.

@derrick4reals derrick4reals May 25, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the review! This case is not reachable in practice: the tab bar is hidden when there is only a single tab (updateTabBarVisibility sets showTabBar = tabCount >= 2), so the × button is never visible for the lone-empty-tab state. No fix needed here.
image

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