fix(plex): address S2 round-2 review nits (typeahead highlight + tests)

- Reset `hi` on Escape and gate `activeOptionId` on `open`, so a dismissed
  panel never exposes an aria-activedescendant pointing at an unmounted option,
  and no stale highlight flashes on reopen (live-verified: aria-activedescendant
  is null when nothing is highlighted / the panel is closed).
- Strengthen the reopen test: setQ now writes back to the mock provider's q, so
  the test asserts a FRESH suggest query fires on retype (q="matrixx"), not just
  that a cached listbox re-appears.
- Add a combobox-ARIA test: role=combobox, aria-expanded toggles with the panel,
  and aria-controls associates the input with the listbox it opens.

Suite 171 green; typecheck + eslint clean.
This commit is contained in:
2026-08-16 08:34:56 +02:00
parent c51df4e0b9
commit 5134ba5433
2 changed files with 38 additions and 5 deletions
+4 -1
View File
@@ -73,7 +73,9 @@ export default function PlexSearchBox() {
const fields = availablePlexFields(scope);
const pillLabel = t(plexFieldLabelKey(activeField));
const activeOptionId = hi >= 0 ? `${listId}-opt-${hi}` : undefined;
// Only reference an option while the listbox is actually open — a dangling aria-activedescendant
// on a collapsed combobox is an inconsistent a11y state.
const activeOptionId = open && hi >= 0 ? `${listId}-opt-${hi}` : undefined;
return (
<SearchBar
@@ -102,6 +104,7 @@ export default function PlexSearchBox() {
pick(hi);
} else if (e.key === "Escape") {
setDismissed(true);
setHi(-1); // don't leave a stale highlight to flash on the next reopen
}
}}
inputProps={{