mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
fix(ui): return Escape focus to the rail item and read rail direction from the panel
A desktop side panel hides once collapsed, so Escape hands focus to its visible rail item instead of the hidden disclosure. Rail selection reads the panel's collapsed class rather than the store, which follows it a microtask late.
This commit is contained in:
1 parent
54b8060f71
commit
231ac4b67b
5 files changed
+81
-5
No files matched your search
@@ -163,6 +163,22 @@ export class PanelChrome {
|
||||
this._locationSearch.value = '';
|
||||
this._locationSearch.blur();
|
||||
},
|
||||
// A desktop side panel hides entirely once collapsed; its rail item
|
||||
// takes the focus its own disclosure can no longer hold.
|
||||
returnFocusTo: () => {
|
||||
const panel = document.getElementById(panelId);
|
||||
if (!panel?.getClientRects || panel.getClientRects().length > 0)
|
||||
return null;
|
||||
const item = document.querySelector?.(
|
||||
`.ui-rail [data-rail-item="${panelId}"]`,
|
||||
);
|
||||
return item &&
|
||||
!item.disabled &&
|
||||
item.getClientRects().length > 0 &&
|
||||
getComputedStyle(item).visibility === 'visible'
|
||||
? item
|
||||
: null;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user