mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Sort control: open with focus on the checked option, not the first
This commit is contained in:
@@ -109,7 +109,12 @@ export function SortControl() {
|
||||
popRef.current = node;
|
||||
if (node) {
|
||||
place();
|
||||
node.querySelector<HTMLElement>('[aria-checked="true"], button')?.focus();
|
||||
// Two queries, not one selector list — `querySelector('a, b')` returns the
|
||||
// first match in document order, which would always be the first button.
|
||||
const target =
|
||||
node.querySelector<HTMLElement>('[aria-checked="true"]') ??
|
||||
node.querySelector<HTMLElement>('button');
|
||||
target?.focus();
|
||||
}
|
||||
},
|
||||
[place],
|
||||
|
||||
Reference in New Issue
Block a user