fix(ui): ignore the persistent workspace list when detecting overlays

This commit is contained in:
Neil
2026-09-05 13:37:51 -07:00
parent a3c1d32995
commit 66bb3ffd73
2 changed files with 14 additions and 0 deletions
@@ -30,6 +30,16 @@ describe('hasVisibleOverlay', () => {
expect(hasVisibleOverlay()).toBe(false)
})
it('ignores the persistent workspace list while preserving its nested popups', () => {
mount('<div role="listbox" data-worktree-sidebar></div>')
expect(hasVisibleOverlay()).toBe(false)
document.querySelector('[data-worktree-sidebar]')!.innerHTML = '<div role="menu"></div>'
expect(hasVisibleOverlay()).toBe(true)
})
it('ignores a display:none overlay', () => {
mount('<div role="dialog" style="display: none"></div>')
+4
View File
@@ -15,6 +15,10 @@ export function hasVisibleOverlay(options?: VisibleOverlayOptions): boolean {
if (!(element instanceof HTMLElement)) {
return false
}
// The persistent workspace list is page chrome, not an Escape-owning popup.
if (element.matches('[role="listbox"][data-worktree-sidebar]')) {
return false
}
if (element.closest('[aria-hidden="true"]')) {
return false
}