mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Open the cockpit panels from the rail in one step and give focus back to it
The rail's buttons are disclosures (aria-expanded, aria-controls) and go through one toggleCockpitUtility action, which already keeps one panel open. Collapsing returns focus to the rail when the launcher's toggle is hidden. The edge switch is gone: edge mode does not apply in the cockpit. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
0c295ea770
commit
95a0be13b6
4 files changed
+112
-48
No files matched your search
+22
-4
@@ -27,10 +27,18 @@ export function bindRadioControls() {
|
||||
this.store?.publishUtility({ ...this._cockpitDisclosure });
|
||||
if (displayOpen) this.actions.revealStyleParameters();
|
||||
if (!expanded && returnFocus) {
|
||||
(kind === 'display'
|
||||
? this._cockpitDisplayToggleBtn
|
||||
: this._cockpitRadioToggleBtn
|
||||
)?.focus({ preventScroll: true });
|
||||
// The desktop cockpit hides the launchers' toggles behind its rail, so
|
||||
// focus goes to whichever of the two is shown.
|
||||
const toggle =
|
||||
kind === 'display'
|
||||
? this._cockpitDisplayToggleBtn
|
||||
: this._cockpitRadioToggleBtn;
|
||||
const railItem = toggle?.ownerDocument?.querySelector?.(
|
||||
`[data-cockpit-rail-item="${kind}"]`,
|
||||
);
|
||||
(toggle?.getClientRects?.().length ? toggle : railItem || toggle)?.focus({
|
||||
preventScroll: true,
|
||||
});
|
||||
}
|
||||
if (
|
||||
!displayOpen &&
|
||||
@@ -444,6 +452,16 @@ export function bindRadioControls() {
|
||||
),
|
||||
toggleCockpitRadio: () =>
|
||||
setCockpitDisclosure('radio', !this._cockpitDisclosureOpen('radio')),
|
||||
/**
|
||||
* Open or close the cockpit's Display or Radio panel; opening one closes
|
||||
* the other.
|
||||
* @param {'display'|'radio'} kind
|
||||
* @param {{ returnFocus?: boolean }} [options]
|
||||
*/
|
||||
toggleCockpitUtility: (kind, { returnFocus = false } = {}) => {
|
||||
const open = !this._cockpitDisclosureOpen(kind);
|
||||
setCockpitDisclosure(kind, open, { returnFocus: !open && returnFocus });
|
||||
},
|
||||
/**
|
||||
* @param {string} filter
|
||||
* @returns {string} The station tag the filter shows afterwards.
|
||||
|
||||
Reference in new issue
Block a user