diff --git a/apps/web/tests/session-panel-layout.e2e.ts b/apps/web/tests/session-panel-layout.e2e.ts index 7d3186d0d4..16a0655268 100644 --- a/apps/web/tests/session-panel-layout.e2e.ts +++ b/apps/web/tests/session-panel-layout.e2e.ts @@ -248,6 +248,15 @@ describe.skipIf(MODE === 'record')('web e2e: Session panel layout', () => { }) await other.mouse.move(5, 5) await expect.poll(async () => (await rowLayout(other)).highlighted).toBe(false) + // The row's open menu keeps the row highlighted and the More button shown after the pointer leaves for the menu. + await row.locator('[data-row-part="menu"] button').click() + await other.getByRole('menu').waitFor() + await other.mouse.move(5, 5) + expect(await rowLayout(other)).toEqual({ + ...resting, menu: { center: 14, target: [24, 24], opacity: '1' }, hovered: false, highlighted: true, + }) + await other.keyboard.press('Escape') + await expect.poll(async () => (await rowLayout(other)).highlighted).toBe(false) expect(errors.pageErrors).toEqual([]) }) }) diff --git a/packages/client/ui-session-panel/src/client/SessionPanel.module.css b/packages/client/ui-session-panel/src/client/SessionPanel.module.css index 85f933374b..4b641c5c09 100644 --- a/packages/client/ui-session-panel/src/client/SessionPanel.module.css +++ b/packages/client/ui-session-panel/src/client/SessionPanel.module.css @@ -325,8 +325,11 @@ } } -/* An open menu keeps its row highlighted and its trigger visible after the pointer leaves for the menu. */ -.panel :where([data-session-panel-row]:has(> button[data-row-part='body'], > [data-row-part='menu']:not(:empty)):has([aria-expanded='true'])) { +/* An open menu keeps its row highlighted and its trigger visible after the + pointer leaves for the menu. Only the menu part counts: a body button that + discloses something else carries aria-expanded too, and its row highlights + on hover alone. */ +.panel :where([data-session-panel-row]:has(> [data-row-part='menu'] [aria-expanded='true'])) { background: var(--dsw-alias-interactive-bg-hover); } diff --git a/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts b/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts index f33d439043..f564deeabb 100644 --- a/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts +++ b/packages/client/ui-session-panel/tests/session-panel-styles.client.spec.ts @@ -123,7 +123,10 @@ describe('SessionPanel.module.css row rules', () => { it('highlights only a row with an action or a menu that renders something, and keeps an open menu and its row shown', () => { const interactive = "[data-session-panel-row]:has(> button[data-row-part='body'], > [data-row-part='menu']:not(:empty))" expect(row("[data-session-panel-row] > [data-row-part='menu']:empty")).toEqual({ display: 'none' }) - expect(row(`${interactive}:has([aria-expanded='true'])`)['background']).toBe('var(--dsw-alias-interactive-bg-hover)') + // Only an open control in the menu part keeps the row highlighted; an expanded body button does not. + expect(row("[data-session-panel-row]:has(> [data-row-part='menu'] [aria-expanded='true'])")) + .toEqual({ background: 'var(--dsw-alias-interactive-bg-hover)' }) + expect(css).not.toMatch(/:has\(\[aria-expanded='true'\]\)\)\s*\{\s*background/) expect(row("[data-session-panel-row] > [data-row-part='menu']:has([aria-expanded='true'])")['opacity']).toBe('1') // Hover rules stay inside the hover media query, where the menu hides until the row is hovered or focused. const hover = /@media \(hover: hover\) \{([\s\S]*?)\n\}/.exec(css)?.[1] ?? ''