fix(ui): show panel toggle tooltip when expanded (#59894)

This commit is contained in:
usrnk1
2026-10-28 15:26:12 +01:00
committed by GitHub
Unverified
parent 8d083cb64d
commit d1bd20facf
2 changed files with 33 additions and 2 deletions
@@ -10,6 +10,33 @@ import { readFile } from "node:fs/promises"
test.use({ viewport: { width: 1440, height: 900 } })
test("review toggle shows its tooltip with the side panel open or closed", async ({ page }) => {
await openSession(page, {
name: "ReviewTooltip",
seed: { panes: { ses_reviewtooltip: { review: true } } },
})
const toggle = page.getByRole("button", { name: "Toggle review", exact: true })
const tooltip = page.getByRole("tooltip", { name: /Toggle review/ })
await expect(toggle).toHaveAttribute("aria-expanded", "true")
await expect(page.locator("#review-panel")).toHaveAttribute("aria-hidden", "false")
await toggle.hover()
await expect(tooltip).toBeVisible()
await toggle.click()
await expect(toggle).toHaveAttribute("aria-expanded", "false")
await page.locator("[data-session-title]").hover()
await expect(tooltip).toBeHidden()
await toggle.hover()
await expect(tooltip).toBeVisible()
await toggle.click()
await expect(toggle).toHaveAttribute("aria-expanded", "true")
await page.locator("[data-session-title]").hover()
await expect(tooltip).toBeHidden()
await toggle.hover()
await expect(tooltip).toBeVisible()
})
for (const view of ["desktop", "mobile"] as const) {
test(`offers Git initialization for a project without VCS (${view})`, async ({ page }) => {
if (view === "mobile") await page.setViewportSize({ width: 390, height: 844 })
+6 -2
View File
@@ -58,7 +58,11 @@ export function Tooltip(props: TooltipProps) {
}
const sync = () => {
const expand = !!ref?.querySelector('[aria-expanded="true"], [data-expanded]')
// Expanded panels still need tooltips; only an open popup suppresses its trigger's tooltip.
const expand = !!ref?.querySelector(
'[aria-haspopup]:not([aria-haspopup="false"]):is([aria-expanded="true"], [data-expanded])',
)
setState("expand", expand)
if (expand) {
@@ -93,7 +97,7 @@ export function Tooltip(props: TooltipProps) {
subtree: true,
childList: true,
attributes: true,
attributeFilter: ["aria-expanded", "data-expanded"],
attributeFilter: ["aria-expanded", "data-expanded", "aria-haspopup"],
})
onCleanup(() => obs.disconnect())
})