🖱️ refactor: Hover the Rail Toggle, New Chat and Marketplace Controls in the Nav Role (#16940)

The sidebar toggle and the Agent Marketplace link use the nav Button variant and the new chat link hovers in surface-nav-hover, so every control in the desktop rail shares the navigation hover the panel buttons and sidebar rows use.
This commit is contained in:
Marco Beretta 2026-10-09 23:07:33 +02:00 • committed by GitHub
parent e4274abf6f
commit b12d09dc5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 40 additions and 3 deletions

View file

@ -44,7 +44,7 @@ export default function AgentMarketplaceButton({
const button = (
<Button
asChild
variant="ghost"
variant="nav"
size={isRow ? 'row' : 'icon'}
className={cn('shrink-0', isRow ? 'w-full justify-start' : 'h-9 w-9')}
>

View file

@ -42,7 +42,7 @@ const NewChatButton = memo(function NewChatButton({
data-testid="new-chat-button"
aria-label={localize('com_ui_new_chat')}
aria-keyshortcuts={ariaKey}
className="hover:bg-surface-hover flex h-9 w-9 items-center justify-center rounded-lg transition-colors"
className="hover:bg-surface-nav-hover flex h-9 w-9 items-center justify-center rounded-lg transition-colors"
onClick={handleNewChatClick}
>
<SquarePen className="text-text-primary h-5 w-5" />
@ -156,7 +156,7 @@ function ExpandedPanel({
id={expanded ? CLOSE_SIDEBAR_ID : undefined}
data-testid={expanded ? 'close-sidebar-button' : 'open-sidebar-button'}
size="icon"
variant="ghost"
variant="nav"
aria-label={localize(toggleLabel)}
aria-expanded={expanded}
aria-keyshortcuts={toggleSidebarAriaKey}

View file

@ -216,6 +216,14 @@ describe('ExpandedPanel', () => {
expect(idle).toHaveAttribute('aria-pressed', 'true');
expect(active).toHaveAttribute('aria-pressed', 'false');
});
it('hovers the sidebar toggle and new chat link in the navigation role', () => {
renderPanel({ expanded: true });
expect(screen.getByTestId('close-sidebar-button')).toHaveClass('hover:bg-surface-nav-hover');
expect(screen.getByTestId('new-chat-button')).toHaveClass('hover:bg-surface-nav-hover');
expect(screen.getByTestId('new-chat-button')).not.toHaveClass('hover:bg-surface-hover');
});
});
describe('NewChatButton panel switch', () => {

View file

@ -85,6 +85,35 @@ test.describe('desktop icon rail', () => {
}
});
test('the rail toggle, new chat and marketplace controls hover in the navigation role @scenario:rail-controls-nav-hover', async ({
page,
}) => {
await installThemeBridge(page);
const cases: Array<[ThemeChoice, Mode, string]> = [
['clickhouse', 'light', rgb(clickHouseTheme.modes.light?.colors?.['rgb-surface-nav-hover'])],
['clickhouse', 'dark', rgb(clickHouseTheme.modes.dark?.colors?.['rgb-surface-nav-hover'])],
['default', 'light', 'rgb(227, 227, 227)'],
['default', 'dark', 'rgb(47, 47, 47)'],
];
for (const [theme, mode, hover] of cases) {
const { idle } = await openRail(page, theme, mode);
await idle.hover();
await expect.poll(() => fill(idle)).toBe(hover);
for (const testId of [
'close-sidebar-button',
'new-chat-button',
'nav-agents-marketplace-button',
]) {
const control = page.getByTestId(testId).filter({ visible: true }).first();
await expect(control).toBeVisible();
await control.hover();
await expect.poll(() => fill(control)).toBe(hover);
}
await page.mouse.move(640, 400);
}
});
test('the default theme keeps the rail selected and hovered fills @scenario:rail-nav-default-unchanged', async ({
page,
}) => {