From 0f5f4e09adc20bb765aa411405b02338f389e2ae Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Wed, 30 Sep 2026 21:20:11 -0400 Subject: [PATCH] Make gallery selection keyboard and screen reader friendly The card and list row stay links. While the gallery is selecting they describe their state (Selected / Not selected), Space toggles them, and aria-keyshortcuts names the Ctrl/Cmd+Enter gesture that starts selecting. The checkbox drawn on each item is now decorative: RCheckbox gains a decorative mode that renders the box without an input or label, so it is no longer a hidden tab stop or interactive content inside a link. Co-Authored-By: Claude Opus 5.5 (1M context) --- frontend/src/locales/bg_BG/rom.json | 2 + frontend/src/locales/cs_CZ/rom.json | 2 + frontend/src/locales/de_DE/rom.json | 2 + frontend/src/locales/en_GB/rom.json | 2 + frontend/src/locales/en_US/rom.json | 2 + frontend/src/locales/es_ES/rom.json | 2 + frontend/src/locales/fr_FR/rom.json | 2 + frontend/src/locales/hu_HU/rom.json | 2 + frontend/src/locales/it_IT/rom.json | 2 + frontend/src/locales/ja_JP/rom.json | 2 + frontend/src/locales/ko_KR/rom.json | 2 + frontend/src/locales/pl_PL/rom.json | 2 + frontend/src/locales/pt_BR/rom.json | 2 + frontend/src/locales/ro_RO/rom.json | 2 + frontend/src/locales/ru_RU/rom.json | 2 + frontend/src/locales/tr_TR/rom.json | 2 + frontend/src/locales/zh_CN/rom.json | 2 + frontend/src/locales/zh_TW/rom.json | 2 + .../src/v2/components/Gallery/GameListRow.vue | 51 ++++++++++++--- .../Gallery/GameListRowCompact.test.ts | 31 ++++++++++ .../v2/components/GameCard/GameCard.test.ts | 28 +++++++-- .../src/v2/components/GameCard/GameCard.vue | 62 ++++++++++++++----- .../lib/forms/RCheckbox/RCheckbox.stories.ts | 28 +++++++++ .../v2/lib/forms/RCheckbox/RCheckbox.test.ts | 15 +++++ .../src/v2/lib/forms/RCheckbox/RCheckbox.vue | 14 ++++- 25 files changed, 233 insertions(+), 32 deletions(-) diff --git a/frontend/src/locales/bg_BG/rom.json b/frontend/src/locales/bg_BG/rom.json index f05482cbe..c87fb047d 100644 --- a/frontend/src/locales/bg_BG/rom.json +++ b/frontend/src/locales/bg_BG/rom.json @@ -435,6 +435,8 @@ "select-file": "Избери {path}", "selected-of": "{selected} от {total} избрани", "selection-count": "{n} игри", + "selection-state-off": "Не е избрано", + "selection-state-on": "Избрано", "set-as-default": "Задай ROM-а като основен", "set-as-default-version": "Задай като версия по подразбиране", "set-status": "Задай статус", diff --git a/frontend/src/locales/cs_CZ/rom.json b/frontend/src/locales/cs_CZ/rom.json index 7dd87e73c..0c0af990e 100644 --- a/frontend/src/locales/cs_CZ/rom.json +++ b/frontend/src/locales/cs_CZ/rom.json @@ -435,6 +435,8 @@ "select-file": "Vybrat {path}", "selected-of": "{selected} z {total} vybráno", "selection-count": "{n} her", + "selection-state-off": "Nevybráno", + "selection-state-on": "Vybráno", "set-as-default": "Nastavit ROM jako výchozí", "set-as-default-version": "Nastavit jako výchozí verzi", "set-status": "Nastavit stav", diff --git a/frontend/src/locales/de_DE/rom.json b/frontend/src/locales/de_DE/rom.json index 49360cb7e..dba8611b4 100644 --- a/frontend/src/locales/de_DE/rom.json +++ b/frontend/src/locales/de_DE/rom.json @@ -435,6 +435,8 @@ "select-file": "{path} auswählen", "selected-of": "{selected} von {total} ausgewählt", "selection-count": "{n} Spiele", + "selection-state-off": "Nicht ausgewählt", + "selection-state-on": "Ausgewählt", "set-as-default": "ROM als Standard setzen", "set-as-default-version": "Als Standardversion festlegen", "set-status": "Status festlegen", diff --git a/frontend/src/locales/en_GB/rom.json b/frontend/src/locales/en_GB/rom.json index 6dbcef43a..d8251eb9a 100644 --- a/frontend/src/locales/en_GB/rom.json +++ b/frontend/src/locales/en_GB/rom.json @@ -435,6 +435,8 @@ "select-file": "Select {path}", "selected-of": "{selected} of {total} selected", "selection-count": "{n} games", + "selection-state-off": "Not selected", + "selection-state-on": "Selected", "set-as-default": "Set ROM as default", "set-as-default-version": "Set as default version", "set-status": "Set status", diff --git a/frontend/src/locales/en_US/rom.json b/frontend/src/locales/en_US/rom.json index e71d319ca..f3dcd0959 100644 --- a/frontend/src/locales/en_US/rom.json +++ b/frontend/src/locales/en_US/rom.json @@ -435,6 +435,8 @@ "select-file": "Select {path}", "selected-of": "{selected} of {total} selected", "selection-count": "{n} games", + "selection-state-off": "Not selected", + "selection-state-on": "Selected", "set-as-default": "Set ROM as default", "set-as-default-version": "Set as default version", "set-status": "Set status", diff --git a/frontend/src/locales/es_ES/rom.json b/frontend/src/locales/es_ES/rom.json index f36105c34..56760cc10 100644 --- a/frontend/src/locales/es_ES/rom.json +++ b/frontend/src/locales/es_ES/rom.json @@ -435,6 +435,8 @@ "select-file": "Seleccionar archivo", "selected-of": "{selected} de {total} seleccionados", "selection-count": "{n} juegos", + "selection-state-off": "No seleccionado", + "selection-state-on": "Seleccionado", "set-as-default": "Establecer ROM por defecto", "set-as-default-version": "Establecer como versión por defecto", "set-status": "Estado", diff --git a/frontend/src/locales/fr_FR/rom.json b/frontend/src/locales/fr_FR/rom.json index ef9dfc54c..ea4372343 100644 --- a/frontend/src/locales/fr_FR/rom.json +++ b/frontend/src/locales/fr_FR/rom.json @@ -435,6 +435,8 @@ "select-file": "Sélectionner {path}", "selected-of": "{selected} sur {total} sélectionné(s)", "selection-count": "{n} jeux", + "selection-state-off": "Non sélectionné", + "selection-state-on": "Sélectionné", "set-as-default": "Définir une ROM par défaut", "set-as-default-version": "Définir comme version par défaut", "set-status": "Définir le statut", diff --git a/frontend/src/locales/hu_HU/rom.json b/frontend/src/locales/hu_HU/rom.json index 52969415b..255055f80 100644 --- a/frontend/src/locales/hu_HU/rom.json +++ b/frontend/src/locales/hu_HU/rom.json @@ -435,6 +435,8 @@ "select-file": "{path} kiválasztása", "selected-of": "{selected} / {total} kiválasztva", "selection-count": "{n} játék", + "selection-state-off": "Nincs kijelölve", + "selection-state-on": "Kijelölve", "set-as-default": "ROM beállítása alapértelmezettként", "set-as-default-version": "Beállítás alapértelmezett verzióként", "set-status": "Állapot beállítása", diff --git a/frontend/src/locales/it_IT/rom.json b/frontend/src/locales/it_IT/rom.json index 711865356..f85c91722 100644 --- a/frontend/src/locales/it_IT/rom.json +++ b/frontend/src/locales/it_IT/rom.json @@ -435,6 +435,8 @@ "select-file": "Seleziona {path}", "selected-of": "{selected} di {total} selezionati", "selection-count": "{n} giochi", + "selection-state-off": "Non selezionato", + "selection-state-on": "Selezionato", "set-as-default": "Imposta ROM come predefinita", "set-as-default-version": "Imposta come versione predefinita", "set-status": "Imposta stato", diff --git a/frontend/src/locales/ja_JP/rom.json b/frontend/src/locales/ja_JP/rom.json index 388619478..d98460a5a 100644 --- a/frontend/src/locales/ja_JP/rom.json +++ b/frontend/src/locales/ja_JP/rom.json @@ -435,6 +435,8 @@ "select-file": "{path}を選択", "selected-of": "{total}件中{selected}件を選択中", "selection-count": "{n}件のゲーム", + "selection-state-off": "未選択", + "selection-state-on": "選択済み", "set-as-default": "ROMをデフォルトに設定", "set-as-default-version": "デフォルトバージョンに設定", "set-status": "ステータスを設定", diff --git a/frontend/src/locales/ko_KR/rom.json b/frontend/src/locales/ko_KR/rom.json index 8f5badb07..ea4f3edbf 100644 --- a/frontend/src/locales/ko_KR/rom.json +++ b/frontend/src/locales/ko_KR/rom.json @@ -435,6 +435,8 @@ "select-file": "{path} 선택", "selected-of": "{total}개 중 {selected}개 선택됨", "selection-count": "{n}개 게임", + "selection-state-off": "선택 안 됨", + "selection-state-on": "선택됨", "set-as-default": "기본 롬으로 설정", "set-as-default-version": "기본 버전으로 설정", "set-status": "상태 설정", diff --git a/frontend/src/locales/pl_PL/rom.json b/frontend/src/locales/pl_PL/rom.json index ebfdda647..e2751e835 100644 --- a/frontend/src/locales/pl_PL/rom.json +++ b/frontend/src/locales/pl_PL/rom.json @@ -435,6 +435,8 @@ "select-file": "Wybierz {path}", "selected-of": "{selected} z {total} wybranych", "selection-count": "{n} gier", + "selection-state-off": "Nie zaznaczono", + "selection-state-on": "Zaznaczono", "set-as-default": "Ustaw ROM jako domyślny", "set-as-default-version": "Ustaw jako wersję domyślną", "set-status": "Ustaw status", diff --git a/frontend/src/locales/pt_BR/rom.json b/frontend/src/locales/pt_BR/rom.json index 931ddc33d..16ea53009 100644 --- a/frontend/src/locales/pt_BR/rom.json +++ b/frontend/src/locales/pt_BR/rom.json @@ -435,6 +435,8 @@ "select-file": "Selecionar {path}", "selected-of": "{selected} de {total} selecionado(s)", "selection-count": "{n} jogos", + "selection-state-off": "Não selecionado", + "selection-state-on": "Selecionado", "set-as-default": "Definir ROM como padrão", "set-as-default-version": "Definir como versão padrão", "set-status": "Definir status", diff --git a/frontend/src/locales/ro_RO/rom.json b/frontend/src/locales/ro_RO/rom.json index 1b5c18b1a..cf72a7b61 100644 --- a/frontend/src/locales/ro_RO/rom.json +++ b/frontend/src/locales/ro_RO/rom.json @@ -435,6 +435,8 @@ "select-file": "Selectează {path}", "selected-of": "{selected} din {total} selectate", "selection-count": "{n} jocuri", + "selection-state-off": "Neselectat", + "selection-state-on": "Selectat", "set-as-default": "Setează ca ROM implicit", "set-as-default-version": "Setează ca versiune implicită", "set-status": "Setează starea", diff --git a/frontend/src/locales/ru_RU/rom.json b/frontend/src/locales/ru_RU/rom.json index 4c81e8447..2c93cb199 100644 --- a/frontend/src/locales/ru_RU/rom.json +++ b/frontend/src/locales/ru_RU/rom.json @@ -435,6 +435,8 @@ "select-file": "Выбрать {path}", "selected-of": "{selected} из {total} выбрано", "selection-count": "{n} игр", + "selection-state-off": "Не выбрано", + "selection-state-on": "Выбрано", "set-as-default": "Установить ром по умолчанию", "set-as-default-version": "Установить как версию по умолчанию", "set-status": "Задать статус", diff --git a/frontend/src/locales/tr_TR/rom.json b/frontend/src/locales/tr_TR/rom.json index 2a630e995..4c5b02836 100644 --- a/frontend/src/locales/tr_TR/rom.json +++ b/frontend/src/locales/tr_TR/rom.json @@ -435,6 +435,8 @@ "select-file": "{path} seç", "selected-of": "{total} dosyadan {selected} seçildi", "selection-count": "{n} oyun", + "selection-state-off": "Seçilmedi", + "selection-state-on": "Seçildi", "set-as-default": "ROM'u varsayılan yap", "set-as-default-version": "Varsayılan sürüm olarak ayarla", "set-status": "Durum ayarla", diff --git a/frontend/src/locales/zh_CN/rom.json b/frontend/src/locales/zh_CN/rom.json index 69aa0aa56..b947ed7d1 100644 --- a/frontend/src/locales/zh_CN/rom.json +++ b/frontend/src/locales/zh_CN/rom.json @@ -435,6 +435,8 @@ "select-file": "选择 {path}", "selected-of": "已选择 {selected} 个,共 {total} 个", "selection-count": "{n} 个游戏", + "selection-state-off": "未选择", + "selection-state-on": "已选择", "set-as-default": "将 ROM 设置为默认", "set-as-default-version": "设为默认版本", "set-status": "设置状态", diff --git a/frontend/src/locales/zh_TW/rom.json b/frontend/src/locales/zh_TW/rom.json index 50d83f5b8..1e5f5ec89 100644 --- a/frontend/src/locales/zh_TW/rom.json +++ b/frontend/src/locales/zh_TW/rom.json @@ -435,6 +435,8 @@ "select-file": "選擇 {path}", "selected-of": "已選擇 {selected} / {total}", "selection-count": "{n} 個遊戲", + "selection-state-off": "未選取", + "selection-state-on": "已選取", "set-as-default": "將 ROM 設為預設", "set-as-default-version": "設為預設版本", "set-status": "設定狀態", diff --git a/frontend/src/v2/components/Gallery/GameListRow.vue b/frontend/src/v2/components/Gallery/GameListRow.vue index 790dd926e..1fa080257 100644 --- a/frontend/src/v2/components/Gallery/GameListRow.vue +++ b/frontend/src/v2/components/Gallery/GameListRow.vue @@ -21,7 +21,7 @@ import { RTooltip, } from "@v2/lib"; import { formatPlaytime, formatReleaseDate, releaseYear } from "@v2/utils/time"; -import { computed, ref } from "vue"; +import { computed, ref, useId } from "vue"; import { useI18n } from "vue-i18n"; import { useRouter } from "vue-router"; import storeCollections from "@/stores/collections"; @@ -127,13 +127,24 @@ const rom = computed(() => { const romName = computed(() => rom.value ? (rom.value.name ?? rom.value.fs_name_no_ext) : "", ); -const checkLabel = computed(() => - t("rom.select-asset", { name: romName.value }), -); - const isSelected = computed(() => !isStatic.value && rom.value ? selection.isSelected(rom.value.id) : false, ); +// While the gallery is selecting, Enter toggles the row instead of opening +// it, so the link describes its selection state. +const selectingRow = computed( + () => !isStatic.value && !!rom.value && selection.enabled, +); +const selectionStateId = useId(); + +// Space toggles a selecting row the way it toggles a native checkbox. +function onRowKeydown(e: KeyboardEvent) { + const item = rom.value; + if (e.key !== " " || !selectingRow.value || !item) return; + if (props.position === undefined) return; + e.preventDefault(); + selection.toggle(item, props.position); +} function onCheckboxClick(e: MouseEvent) { e.preventDefault(); @@ -350,16 +361,30 @@ function onRowPointerDown(e: PointerEvent) { :style="[smAndDown ? undefined : gridStyle, entranceStyle]" :href="rom ? `/rom/${rom.id}` : undefined" :aria-label="rom ? t('common.open-item', { name: romName }) : undefined" + :aria-describedby="selectingRow ? selectionStateId : undefined" + :aria-keyshortcuts=" + rom && !isStatic ? 'Control+Enter Meta+Enter' : undefined + " :data-rom-position="position" :data-rom-id="rom?.id" :data-focus-key="rom ? `rom-${rom.id}` : undefined" @click="onRowClick" + @keydown="onRowKeydown" @mouseenter="onRowHighlight" @focus="onRowHighlight" @pointerdown="onRowPointerDown" @contextmenu="selectionInput.handleContextMenu" @animationend.self="endEntrance" > + + {{ + isSelected ? t("rom.selection-state-on") : t("rom.selection-state-off") + }} +