mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 08:03:20 +00:00
refactor(ui): fold the sidebar overlay exemption into the selector
Match the existing self-exclusion convention used by useWorkspaceBoardPanel and AgentDashboardDrawer instead of a separate matches() guard, and drop the non-null assertion from the test. No behavior change.
This commit is contained in:
@@ -35,7 +35,7 @@ describe('hasVisibleOverlay', () => {
|
||||
|
||||
expect(hasVisibleOverlay()).toBe(false)
|
||||
|
||||
document.querySelector('[data-worktree-sidebar]')!.innerHTML = '<div role="menu"></div>'
|
||||
mount('<div role="listbox" data-worktree-sidebar><div role="menu"></div></div>')
|
||||
|
||||
expect(hasVisibleOverlay()).toBe(true)
|
||||
})
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const OVERLAY_SELECTOR = '[role="dialog"], [role="alertdialog"], [role="listbox"], [role="menu"]'
|
||||
// The always-mounted worktree sidebar is page chrome, not an Escape-owning popup.
|
||||
const OVERLAY_SELECTOR =
|
||||
'[role="dialog"], [role="alertdialog"], [role="listbox"]:not([data-worktree-sidebar]), [role="menu"]'
|
||||
|
||||
type VisibleOverlayOptions = {
|
||||
/** Overlays inside a match are treated as page content, not as a layer above it. */
|
||||
@@ -15,10 +17,6 @@ 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user