Sort control: open with focus on the checked option, not the first

This commit is contained in:
2026-06-12 14:45:45 +03:00
parent ed66fe9c05
commit fe9d588103
+6 -1
View File
@@ -109,7 +109,12 @@ export function SortControl() {
popRef.current = node; popRef.current = node;
if (node) { if (node) {
place(); 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], [place],