diff --git a/frontend/src/locales/bg_BG/common.json b/frontend/src/locales/bg_BG/common.json index ed1d2648a..83774bec7 100644 --- a/frontend/src/locales/bg_BG/common.json +++ b/frontend/src/locales/bg_BG/common.json @@ -41,6 +41,7 @@ "confirm": "Потвърди", "confirm-deletion": "Потвърди изтриването", "copy-code": "Копирай кода", + "copy-hash": "Копирай {label} хеша", "core": "Основни", "create": "Създай", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Генерирай", "genres-n": "{n} жанр | {n} жанра", "got-it": "Разбрах", + "hide-full-hash": "Скрий пълния {label} хеш", "hide-password": "Скрий паролата", "home": "Начало", "in-library": "В библиотеката", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Статистики на сървъра", "settings": "Настройки", + "show-full-hash": "Покажи пълния {label} хеш", "show-password": "Покажи паролата", "shuffle": "Разбъркване", "size": "Размер", diff --git a/frontend/src/locales/cs_CZ/common.json b/frontend/src/locales/cs_CZ/common.json index 380578a4f..e33b20aec 100644 --- a/frontend/src/locales/cs_CZ/common.json +++ b/frontend/src/locales/cs_CZ/common.json @@ -41,6 +41,7 @@ "confirm": "Potvrdit", "confirm-deletion": "Potvrdit smazání", "copy-code": "Kopírovat kód", + "copy-hash": "Zkopírovat hash {label}", "core": "Jádro", "create": "Vytvořit", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Vygenerovat", "genres-n": "{n} žánr | {n} žánry", "got-it": "Rozumím", + "hide-full-hash": "Skrýt celý hash {label}", "hide-password": "Skrýt heslo", "home": "Domů", "in-library": "V knihovně", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Statistiky serveru", "settings": "Nastavení", + "show-full-hash": "Zobrazit celý hash {label}", "show-password": "Zobrazit heslo", "shuffle": "Náhodné pořadí", "size": "Velikost", diff --git a/frontend/src/locales/de_DE/common.json b/frontend/src/locales/de_DE/common.json index ec2e5875f..63e9b1f00 100644 --- a/frontend/src/locales/de_DE/common.json +++ b/frontend/src/locales/de_DE/common.json @@ -41,6 +41,7 @@ "confirm": "Bestätigen", "confirm-deletion": "Löschung bestätigen", "copy-code": "Code kopieren", + "copy-hash": "{label}-Hash kopieren", "core": "Core", "create": "Erstellen", "crt-mode": "CRT-Modus", @@ -70,6 +71,7 @@ "generate": "Generieren", "genres-n": "{n} Genre | {n} Genres", "got-it": "Verstanden", + "hide-full-hash": "Vollständigen {label}-Hash ausblenden", "hide-password": "Passwort ausblenden", "home": "Startseite", "in-library": "In der Bibliothek", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Serverstatistiken", "settings": "Einstellungen", + "show-full-hash": "Vollständigen {label}-Hash anzeigen", "show-password": "Passwort anzeigen", "shuffle": "Zufallswiedergabe", "size": "Größe", diff --git a/frontend/src/locales/en_GB/common.json b/frontend/src/locales/en_GB/common.json index 0f8e34dac..5e62503f9 100644 --- a/frontend/src/locales/en_GB/common.json +++ b/frontend/src/locales/en_GB/common.json @@ -41,6 +41,7 @@ "confirm": "Confirm", "confirm-deletion": "Confirm Deletion", "copy-code": "Copy code", + "copy-hash": "Copy {label} hash", "core": "Core", "create": "Create", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Generate", "genres-n": "{n} genre | {n} genres", "got-it": "Got it", + "hide-full-hash": "Hide full {label} hash", "hide-password": "Hide password", "home": "Home", "in-library": "In library", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Server stats", "settings": "Settings", + "show-full-hash": "Show full {label} hash", "show-password": "Show password", "shuffle": "Shuffle", "size": "Size", diff --git a/frontend/src/locales/en_US/common.json b/frontend/src/locales/en_US/common.json index 0f8e34dac..5e62503f9 100644 --- a/frontend/src/locales/en_US/common.json +++ b/frontend/src/locales/en_US/common.json @@ -41,6 +41,7 @@ "confirm": "Confirm", "confirm-deletion": "Confirm Deletion", "copy-code": "Copy code", + "copy-hash": "Copy {label} hash", "core": "Core", "create": "Create", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Generate", "genres-n": "{n} genre | {n} genres", "got-it": "Got it", + "hide-full-hash": "Hide full {label} hash", "hide-password": "Hide password", "home": "Home", "in-library": "In library", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Server stats", "settings": "Settings", + "show-full-hash": "Show full {label} hash", "show-password": "Show password", "shuffle": "Shuffle", "size": "Size", diff --git a/frontend/src/locales/es_ES/common.json b/frontend/src/locales/es_ES/common.json index d047def9a..f2558c525 100644 --- a/frontend/src/locales/es_ES/common.json +++ b/frontend/src/locales/es_ES/common.json @@ -41,6 +41,7 @@ "confirm": "Confirmar", "confirm-deletion": "Confirmar eliminación", "copy-code": "Copiar código", + "copy-hash": "Copiar hash {label}", "core": "Núcleo", "create": "Crear", "crt-mode": "Modo CRT", @@ -70,6 +71,7 @@ "generate": "Generar", "genres-n": "{n} género | {n} géneros", "got-it": "Entendido", + "hide-full-hash": "Ocultar hash {label} completo", "hide-password": "Ocultar contraseña", "home": "Inicio", "in-library": "En biblioteca", @@ -130,6 +132,7 @@ "server-reconnected": "Conexión con el servidor restablecida", "server-stats": "Estadísticas del servidor", "settings": "Ajustes", + "show-full-hash": "Mostrar hash {label} completo", "show-password": "Mostrar contraseña", "shuffle": "Mezclar", "size": "Tamaño", diff --git a/frontend/src/locales/fr_FR/common.json b/frontend/src/locales/fr_FR/common.json index d3637179a..030264f31 100644 --- a/frontend/src/locales/fr_FR/common.json +++ b/frontend/src/locales/fr_FR/common.json @@ -41,6 +41,7 @@ "confirm": "Confirmer", "confirm-deletion": "Confirmer la suppression", "copy-code": "Copier le code", + "copy-hash": "Copier le hachage {label}", "core": "Noyau", "create": "Créer", "crt-mode": "Mode CRT", @@ -70,6 +71,7 @@ "generate": "Générer", "genres-n": "{n} genre | {n} genres", "got-it": "Compris", + "hide-full-hash": "Masquer le hachage {label} complet", "hide-password": "Masquer le mot de passe", "home": "Accueil", "in-library": "Dans la bibliothèque", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Statistiques du serveur", "settings": "Paramètres", + "show-full-hash": "Afficher le hachage {label} complet", "show-password": "Afficher le mot de passe", "shuffle": "Lecture aléatoire", "size": "Taille", diff --git a/frontend/src/locales/hu_HU/common.json b/frontend/src/locales/hu_HU/common.json index 609655694..2945e5095 100644 --- a/frontend/src/locales/hu_HU/common.json +++ b/frontend/src/locales/hu_HU/common.json @@ -41,6 +41,7 @@ "confirm": "Megerősítés", "confirm-deletion": "Törlés megerősítése", "copy-code": "Kód másolása", + "copy-hash": "{label} hash-érték másolása", "core": "Mag", "create": "Létrehoz", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Generálás", "genres-n": "{n} műfaj | {n} műfaj", "got-it": "Értem", + "hide-full-hash": "A teljes {label} hash-érték elrejtése", "hide-password": "Jelszó elrejtése", "home": "Kezdőlap", "in-library": "A könyvtárban", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Szerver statisztika", "settings": "Beállítások", + "show-full-hash": "A teljes {label} hash-érték megjelenítése", "show-password": "Jelszó megjelenítése", "shuffle": "Véletlen sorrend", "size": "Méret", diff --git a/frontend/src/locales/it_IT/common.json b/frontend/src/locales/it_IT/common.json index eece85c2b..9ed24f883 100644 --- a/frontend/src/locales/it_IT/common.json +++ b/frontend/src/locales/it_IT/common.json @@ -41,6 +41,7 @@ "confirm": "Conferma", "confirm-deletion": "Conferma eliminazione", "copy-code": "Copia codice", + "copy-hash": "Copia hash {label}", "core": "Core", "create": "Crea", "crt-mode": "Modalità CRT", @@ -70,6 +71,7 @@ "generate": "Genera", "genres-n": "{n} genere | {n} generi", "got-it": "Ho capito", + "hide-full-hash": "Nascondi hash {label} completo", "hide-password": "Nascondi password", "home": "Home", "in-library": "In libreria", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Statistiche del server", "settings": "Impostazioni", + "show-full-hash": "Mostra hash {label} completo", "show-password": "Mostra password", "shuffle": "Riproduzione casuale", "size": "Dimensione", diff --git a/frontend/src/locales/ja_JP/common.json b/frontend/src/locales/ja_JP/common.json index 187413adb..667dfd31d 100644 --- a/frontend/src/locales/ja_JP/common.json +++ b/frontend/src/locales/ja_JP/common.json @@ -41,6 +41,7 @@ "confirm": "確定", "confirm-deletion": "削除の確認", "copy-code": "コードをコピー", + "copy-hash": "{label} ハッシュをコピー", "core": "コア", "create": "作成", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "生成", "genres-n": "{n}件のジャンル", "got-it": "了解", + "hide-full-hash": "{label} ハッシュ全体を隠す", "hide-password": "パスワードを隠す", "home": "ホーム", "in-library": "ライブラリ内", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "サーバーステータス", "settings": "設定", + "show-full-hash": "{label} ハッシュ全体を表示", "show-password": "パスワードを表示", "shuffle": "シャッフル", "size": "サイズ", diff --git a/frontend/src/locales/ko_KR/common.json b/frontend/src/locales/ko_KR/common.json index cf4cbce32..91411af21 100644 --- a/frontend/src/locales/ko_KR/common.json +++ b/frontend/src/locales/ko_KR/common.json @@ -41,6 +41,7 @@ "confirm": "확인", "confirm-deletion": "삭제 확인", "copy-code": "코드 복사", + "copy-hash": "{label} 해시 복사", "core": "코어", "create": "생성", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "생성", "genres-n": "장르 {n}개", "got-it": "확인", + "hide-full-hash": "전체 {label} 해시 숨기기", "hide-password": "비밀번호 숨기기", "home": "홈", "in-library": "라이브러리에 있음", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "서버 통계", "settings": "설정", + "show-full-hash": "전체 {label} 해시 표시", "show-password": "비밀번호 표시", "shuffle": "셔플", "size": "크기", diff --git a/frontend/src/locales/pl_PL/common.json b/frontend/src/locales/pl_PL/common.json index dc81f88e0..8eb32ccad 100644 --- a/frontend/src/locales/pl_PL/common.json +++ b/frontend/src/locales/pl_PL/common.json @@ -41,6 +41,7 @@ "confirm": "Potwierdź", "confirm-deletion": "Potwierdź usunięcie", "copy-code": "Kopiuj kod", + "copy-hash": "Skopiuj hash {label}", "core": "Rdzeń", "create": "Utwórz", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Generuj", "genres-n": "{n} gatunek | {n} gatunki | {n} gatunków", "got-it": "Rozumiem", + "hide-full-hash": "Ukryj pełny hash {label}", "hide-password": "Ukryj hasło", "home": "Strona główna", "in-library": "W bibliotece", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Statystyki serwera", "settings": "Ustawienia", + "show-full-hash": "Pokaż pełny hash {label}", "show-password": "Pokaż hasło", "shuffle": "Odtwarzanie losowe", "size": "Rozmiar", diff --git a/frontend/src/locales/pt_BR/common.json b/frontend/src/locales/pt_BR/common.json index caaa93c20..754dde1c9 100644 --- a/frontend/src/locales/pt_BR/common.json +++ b/frontend/src/locales/pt_BR/common.json @@ -41,6 +41,7 @@ "confirm": "Confirmar", "confirm-deletion": "Confirmar exclusão", "copy-code": "Copiar código", + "copy-hash": "Copiar hash {label}", "core": "Núcleo", "create": "Criar", "crt-mode": "Modo CRT", @@ -70,6 +71,7 @@ "generate": "Gerar", "genres-n": "{n} gênero | {n} gêneros", "got-it": "Entendi", + "hide-full-hash": "Ocultar hash {label} completo", "hide-password": "Ocultar senha", "home": "Início", "in-library": "Na biblioteca", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Estatísticas do servidor", "settings": "Configurações", + "show-full-hash": "Mostrar hash {label} completo", "show-password": "Mostrar senha", "shuffle": "Embaralhar", "size": "Tamanho", diff --git a/frontend/src/locales/ro_RO/common.json b/frontend/src/locales/ro_RO/common.json index 4f87252e7..0f6302573 100644 --- a/frontend/src/locales/ro_RO/common.json +++ b/frontend/src/locales/ro_RO/common.json @@ -41,6 +41,7 @@ "confirm": "Confirmă", "confirm-deletion": "Confirmă ștergerea", "copy-code": "Copiază codul", + "copy-hash": "Copiază hash-ul {label}", "core": "Nucleu", "create": "Creează", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Generează", "genres-n": "{n} gen | {n} genuri", "got-it": "Am înțeles", + "hide-full-hash": "Ascunde hash-ul {label} complet", "hide-password": "Ascunde parola", "home": "Acasă", "in-library": "În bibliotecă", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Statistici server", "settings": "Setări", + "show-full-hash": "Afișează hash-ul {label} complet", "show-password": "Afișează parola", "shuffle": "Amestecă", "size": "Dimensiune", diff --git a/frontend/src/locales/ru_RU/common.json b/frontend/src/locales/ru_RU/common.json index a868a128a..43c7e919d 100644 --- a/frontend/src/locales/ru_RU/common.json +++ b/frontend/src/locales/ru_RU/common.json @@ -41,6 +41,7 @@ "confirm": "Подтвердить", "confirm-deletion": "Подтвердить удаление", "copy-code": "Копировать код", + "copy-hash": "Скопировать хеш {label}", "core": "Ядро", "create": "Создать", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "Сгенерировать", "genres-n": "{n} жанр | {n} жанра | {n} жанров", "got-it": "Понятно", + "hide-full-hash": "Скрыть полный хеш {label}", "hide-password": "Скрыть пароль", "home": "Главная", "in-library": "В библиотеке", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "Статистика сервера", "settings": "Настройки", + "show-full-hash": "Показать полный хеш {label}", "show-password": "Показать пароль", "shuffle": "Перемешать", "size": "Размер", diff --git a/frontend/src/locales/tr_TR/common.json b/frontend/src/locales/tr_TR/common.json index 8db80376b..90382f4b1 100644 --- a/frontend/src/locales/tr_TR/common.json +++ b/frontend/src/locales/tr_TR/common.json @@ -41,6 +41,7 @@ "confirm": "Onayla", "confirm-deletion": "Silmeyi Onayla", "copy-code": "Kodu kopyala", + "copy-hash": "{label} hash değerini kopyala", "core": "Çekirdek", "create": "Oluştur", "crt-mode": "CRT modu", @@ -70,6 +71,7 @@ "generate": "Oluştur", "genres-n": "{n} tür", "got-it": "Anladım", + "hide-full-hash": "Tam {label} hash değerini gizle", "hide-password": "Şifreyi gizle", "home": "Ana sayfa", "in-library": "Kütüphanede", @@ -130,6 +132,7 @@ "server-reconnected": "Sunucuya yeniden bağlanıldı", "server-stats": "Sunucu istatistikleri", "settings": "Ayarlar", + "show-full-hash": "Tam {label} hash değerini göster", "show-password": "Şifreyi göster", "shuffle": "Karıştır", "size": "Boyut", diff --git a/frontend/src/locales/zh_CN/common.json b/frontend/src/locales/zh_CN/common.json index e652ac0e5..4da5b4465 100644 --- a/frontend/src/locales/zh_CN/common.json +++ b/frontend/src/locales/zh_CN/common.json @@ -41,6 +41,7 @@ "confirm": "确认", "confirm-deletion": "确认删除", "copy-code": "复制代码", + "copy-hash": "复制 {label} 哈希值", "core": "核心", "create": "创建", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "生成", "genres-n": "{n} 个类型", "got-it": "知道了", + "hide-full-hash": "隐藏完整 {label} 哈希值", "hide-password": "隐藏密码", "home": "首页", "in-library": "在游戏库中", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "服务器状态", "settings": "设置", + "show-full-hash": "显示完整 {label} 哈希值", "show-password": "显示密码", "shuffle": "随机播放", "size": "容量", diff --git a/frontend/src/locales/zh_TW/common.json b/frontend/src/locales/zh_TW/common.json index 4a5fe6407..56806bdec 100644 --- a/frontend/src/locales/zh_TW/common.json +++ b/frontend/src/locales/zh_TW/common.json @@ -41,6 +41,7 @@ "confirm": "確認", "confirm-deletion": "確認刪除", "copy-code": "複製代碼", + "copy-hash": "複製 {label} 雜湊值", "core": "核心", "create": "建立", "crt-mode": "CRT mode", @@ -70,6 +71,7 @@ "generate": "產生", "genres-n": "{n} 個類型", "got-it": "我知道了", + "hide-full-hash": "隱藏完整 {label} 雜湊值", "hide-password": "隱藏密碼", "home": "首頁", "in-library": "已在遊戲庫", @@ -130,6 +132,7 @@ "server-reconnected": "Reconnected to the server", "server-stats": "伺服器狀態", "settings": "設定", + "show-full-hash": "顯示完整 {label} 雜湊值", "show-password": "顯示密碼", "shuffle": "隨機播放", "size": "大小", diff --git a/frontend/src/v2/components/shared/HashChip.test.ts b/frontend/src/v2/components/shared/HashChip.test.ts index 11fad4576..c22cc35b2 100644 --- a/frontend/src/v2/components/shared/HashChip.test.ts +++ b/frontend/src/v2/components/shared/HashChip.test.ts @@ -135,4 +135,57 @@ describe("HashChip", () => { expect(copy).toHaveBeenCalled(); expect(wrapper.text()).toContain(SHA1); }); + + // The core of #4105: screen readers need the action as the accessible + // name and, when the chip is a disclosure, the expanded/collapsed state. + describe("ARIA state", () => { + it("names the copy action and carries no aria-expanded when the clipboard works", () => { + const wrapper = mountChip(); + + const button = wrapper.find("button"); + expect(button.attributes("aria-label")).toBe( + 'common.copy-hash:{"label":"SHA-1"}', + ); + expect(button.attributes("aria-expanded")).toBeUndefined(); + }); + + it("announces the disclosure state when the clipboard is unavailable", async () => { + clipboard.isSupported = false; + const wrapper = mountChip(); + + expect(wrapper.find("button").attributes("aria-expanded")).toBe("false"); + expect(wrapper.find("button").attributes("aria-label")).toBe( + 'common.show-full-hash:{"label":"SHA-1"}', + ); + + await click(wrapper); + + expect(wrapper.find("button").attributes("aria-expanded")).toBe("true"); + expect(wrapper.find("button").attributes("aria-label")).toBe( + 'common.hide-full-hash:{"label":"SHA-1"}', + ); + + await click(wrapper); + + expect(wrapper.find("button").attributes("aria-expanded")).toBe("false"); + expect(wrapper.find("button").attributes("aria-label")).toBe( + 'common.show-full-hash:{"label":"SHA-1"}', + ); + }); + + // A failed copy discloses the value but the next click still copies, + // so the state flips to expanded while the name stays the copy action. + it("marks the fallback reveal after a failed copy as expanded", async () => { + copy.mockResolvedValue(false); + const wrapper = mountChip(); + + await click(wrapper); + + const button = wrapper.find("button"); + expect(button.attributes("aria-expanded")).toBe("true"); + expect(button.attributes("aria-label")).toBe( + 'common.copy-hash:{"label":"SHA-1"}', + ); + }); + }); }); diff --git a/frontend/src/v2/components/shared/HashChip.vue b/frontend/src/v2/components/shared/HashChip.vue index 436c3b8de..59e329a86 100644 --- a/frontend/src/v2/components/shared/HashChip.vue +++ b/frontend/src/v2/components/shared/HashChip.vue @@ -57,6 +57,23 @@ const appendIcon = computed(() => { return clipboard.isSupported ? "mdi-content-copy" : "mdi-eye-outline"; }); +// Present only while the chip acts as a disclosure (the reveal toggle, or a +// value revealed by a failed copy); a pure copy button carries no aria-expanded. +const ariaExpanded = computed(() => { + if (clipboard.isSupported && !revealed.value) return undefined; + return revealed.value; +}); + +// The visible text is just the label and abbreviated value, so the accessible +// name spells out what a click does instead. +const ariaLabel = computed(() => { + if (clipboard.isSupported) + return t("common.copy-hash", { label: props.label }); + return revealed.value + ? t("common.hide-full-hash", { label: props.label }) + : t("common.show-full-hash", { label: props.label }); +}); + // Scoped to this chip so a selection made elsewhere on the page does not // leave the collapse click dead. function hasSelectionInside() { @@ -92,6 +109,8 @@ async function copy() { class="r-v2-hash-chip" :class="{ 'r-v2-hash-chip--revealed': revealed }" :title="`${label}: ${value}`" + :aria-expanded="ariaExpanded" + :aria-label="ariaLabel" @click="copy" >