Fix invisible close button click zone on chat tabs - #5012
builder-io-integration[bot] wants to merge 1 commit into
Conversation
The chat tab bar's close (X) affordance was rendered at opacity:0 by default and only became visible on hover, but the underlying button stayed fully clickable while invisible. A click anywhere in that 28px-wide strip on the right edge of a tab — even without any visible hover state having registered — would silently close the tab instead of switching to it. Make the close button unclickable while it is not visibly revealed: pointer-events:none by default, pointer-events:auto (with the icon shown) only once the tab is hovered or the button itself is keyboard-focused. This keeps the existing hover-reveal look used across the tab bar but removes the invisible-but-clickable zone. Applies to both shared tab-bar implementations that duplicate this pattern: MultiTabAssistantChat (used by Slides and other AgentSidebar surfaces) and AgentPanel (the main app chat panel).
There was a problem hiding this comment.
Builder reviewed your changes and has a few items to flag 🟡
Review Details
Code Review Summary
PR #5012 addresses the invisible close affordance in the shared chat-tab CSS by disabling pointer events while the close button is hidden and restoring them for hover/focus-visible states. The approach is appropriate for MultiTabAssistantChat, where .agent-tab wraps the close button, and the change is low risk in scope because it is limited to shared UI CSS and a regression test.
Key Findings
Medium: In AgentPanel.tsx, the close button is a sibling of the .agent-tab element, so the new descendant selector .agent-tab:hover .agent-tab-close never matches. Mouse users therefore lose the ability to reveal and click the close control in AgentPanel; the old invisible-but-clickable behavior is removed without a working visible hover path. The selector should target the shared wrapper or the DOM should be adjusted.
Medium: The added jsdom test uses direct .click() calls and does not exercise browser hit testing or the invisible overlay coordinates, so it passes with the old CSS too and does not guard the reported regression.
The explicit :focus-visible path is a good accessibility affordance, and the MultiTabAssistantChat selector structure is consistent with the intended behavior.
🧪 Browser testing: Could not verify — dev server was healthy, but all browser executors lacked Chrome automation tools after retry; the affected flows were reported as couldnt_verify/escalated.
Summary
Fixes an accidental chat-tab-closing bug by making the close ("X") button's hit area only clickable when it's visibly shown (on hover or focus), instead of being clickable while invisible.
Problem
In the tab bar used by
AgentPanelandMultiTabAssistantChat, the.agent-tab-closeelement was hidden viaopacity:0but still received pointer events. This meant users could click in the close-button area without seeing any visual affordance (no X icon, no hover state), and accidentally close a chat tab they intended to keep open — as reported in Slack.Slack source: https://slack.com/app_redirect?team=T0GCV21GE&channel=C0ATH3CCZT4&message_ts=1789428768.771499
Factory item:
1c7871fd3c45162d14089abb1d8c9dda620129b1e1b7d93281d3d119cf19c08eSolution
Added
pointer-events:noneto the hidden state of.agent-tab-close, andpointer-events:autoalongsideopacity:1when the tab is hovered or the close button is focus-visible. This ensures the close button is only clickable when it is actually visible, eliminating the invisible hit-zone while preserving the existing hover-reveal pattern.This fix applies to two shared instances of the same tab bar pattern:
AgentPanel.tsxandMultiTabAssistantChat.tsx, both of which had the identical CSS.Key Changes
packages/core/src/client/AgentPanel.tsx: Updated.agent-tab-closestyles so the close button ispointer-events:nonewhen hidden andpointer-events:autoonly when visible via hover or:focus-visible.packages/core/src/client/MultiTabAssistantChat.tsx: Applied the same fix to its identical.agent-tab-closestyle block.packages/core/src/client/MultiTabAssistantChat.spec.tsx: Added a regression test verifying each tab renders a labeled close button (aria-label="Close tab") and that clicking the tab's switch button (not the close button) never closes the tab, while clicking the explicit close button correctly closes only that tab.To clone this PR locally use the Github CLI with command
gh pr checkout 5012You can tag me at @BuilderIO for anything you want me to fix or change