fix(session-panel): keep a row highlighted only for its own open menu
A panel row stayed highlighted while anything inside it carried aria-expanded="true". The rule means a row's open menu, so it now names the menu part: a body button that discloses something else highlights its row on hover alone. The layout e2e opens the working folder row's menu in the real app and checks that the row keeps its highlight and its More button after the pointer leaves for the menu.
This commit is contained in:
1 parent
99e03fb7b2
commit
46cf27ce35
3 files changed
+18
-3
No files matched your search
@@ -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([])
|
||||
})
|
||||
})
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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] ?? ''
|
||||
|
||||
Reference in new issue
Block a user