fix(search-select): move field id to inner search input (issue #30)

The id (e.g. id_related_game) sat on the <search-select> wrapper, a
non-labelable custom element. Consequences:
- <label for="id_X"> focused nothing (a11y gap)
- .disabled / .focus() on #id_X silently no-oped
- add_purchase.ts needed a [data-search-select-search] descendant
  workaround to gate related_game on the type field

id is now on the [data-search-select-search] <input>, making it a real
labelable, disableable control. add_purchase.ts drops the workaround
and gates via #id_related_game directly. E2e tests updated; new test
asserts label-click focuses the search box.

Closes #30
This commit is contained in:
2026-06-20 18:34:07 +02:00
parent b3fa7fac96
commit b816c68cb8
3 changed files with 43 additions and 28 deletions
+1 -6
View File
@@ -53,12 +53,7 @@ onSwap("#id_separate_prices", (checkbox) => {
});
function setupElementHandlers(): void {
// related_game is a SearchSelect: its #id_related_game wrapper is a <div>
// (ignores `disabled`), so target the inner search <input> instead.
disableElementsWhenTrue("#id_type", "game", [
"#id_name",
"#id_related_game [data-search-select-search]",
]);
disableElementsWhenTrue("#id_type", "game", ["#id_name", "#id_related_game"]);
}
onSwap("#id_type", (typeSelect) => {