mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 10:01:00 +01:00
fix(v2): announce the hash chip's disclosure state and action
Hash chips read as plain buttons to screen readers: no aria-expanded, and the accessible name was the abbreviated hash text. The button now carries aria-expanded whenever it actually behaves as a disclosure (reveal mode, or a copy whose failure disclosed the value) and an aria-label that names the action and the hash kind, translated in every locale. Fixes #4105 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ldi4YaXJWDDmFdbKfQay8L
This commit is contained in:
@@ -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": "Размер",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "サイズ",
|
||||
|
||||
@@ -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": "크기",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "Размер",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "容量",
|
||||
|
||||
@@ -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": "大小",
|
||||
|
||||
@@ -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"}',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
<RTag
|
||||
|
||||
Reference in New Issue
Block a user