From a86726a76ee04c5d1b665c52e3c10b731fe418f4 Mon Sep 17 00:00:00 2001 From: repires Date: Wed, 25 Nov 2026 02:03:55 -0600 Subject: [PATCH] fix(a11y): name controls by their visible text and fix ARIA roles Findings from re-auditing master with axe (#354): - Names that did not contain the visible text, which breaks speech input: the add-remote menu items (the app menu had this fixed in #355), the overview header's backend switch, the remote detail action pills and the Rclone Flags reset button. They are now named by their text; the longer wording stays as the tooltip. The backend switch's logo is decorative, and its unused aria string is removed. - The remote config sidebar put aria-selected on navigation list items; the current step or profile is aria-current instead. - About listed its pages as tabs, with a second tab list and dividers inside the first. They open sub-pages, so they are plain buttons. - The general and Quick Run overviews added role="main" inside the workspace shell's
, so the page had two. - The file browser as an overlay or picker had no main landmark: since #366 everything behind it is inert, so it is always the page's main. - Remote card names were h4 under the h2 overview title; now h3. --- resources/i18n/en-US/main.json | 3 +-- resources/i18n/es-ES/main.json | 3 +-- resources/i18n/fr-FR/main.json | 3 +-- resources/i18n/ja-JP/main.json | 3 +-- resources/i18n/pt-BR/main.json | 3 +-- resources/i18n/ru-RU/main.json | 3 +-- resources/i18n/sk-SK/main.json | 3 +-- resources/i18n/tr-TR/main.json | 3 +-- resources/i18n/uk-UA/main.json | 3 +-- resources/i18n/zh-CN/main.json | 3 +-- resources/i18n/zh-TW/main.json | 3 +-- .../general-detail.component.html | 1 - .../general-detail.component.spec.ts | 2 ++ .../general-detail.component.ts | 5 +--- .../general-overview.component.html | 2 +- .../config-modal-sidebar.component.html | 4 +-- .../about-modal/about-modal.component.html | 16 +++--------- .../about-modal/about-modal.component.spec.ts | 7 +++++ .../rclone-flags-modal.component.html | 2 +- .../nautilus/nautilus.component.html | 10 +++---- .../nautilus/nautilus.component.spec.ts | 26 +------------------ .../nautilus/nautilus.component.ts | 22 ---------------- .../quick-run-overview.component.html | 2 +- .../layout/titlebar/titlebar.component.html | 7 +---- .../overview-header.component.html | 5 +--- .../overview-header.component.spec.ts | 20 +++++++------- .../remote-card/remote-card.component.html | 4 +-- .../remote-card/remote-card.component.spec.ts | 5 ++++ src/app/shared/types/ui.ts | 1 - src/testing/axe.spec.ts | 1 - 30 files changed, 53 insertions(+), 122 deletions(-) diff --git a/resources/i18n/en-US/main.json b/resources/i18n/en-US/main.json index 1be4eecb3..2ec18d46d 100644 --- a/resources/i18n/en-US/main.json +++ b/resources/i18n/en-US/main.json @@ -1105,8 +1105,7 @@ "cancel": "Cancel" }, "overviewHeader": { - "manageBackends": "Manage Backends", - "backendSwitchAria": "Current mode: {{title}} - Click to switch backend" + "manageBackends": "Manage Backends" }, "settingControl": { "default": "Default: {{value}}", diff --git a/resources/i18n/es-ES/main.json b/resources/i18n/es-ES/main.json index 046a78f06..2973654a4 100644 --- a/resources/i18n/es-ES/main.json +++ b/resources/i18n/es-ES/main.json @@ -1105,8 +1105,7 @@ "cancel": "Cancelar" }, "overviewHeader": { - "manageBackends": "Gestionar backends", - "backendSwitchAria": "Modo actual: {{title}} - Haga clic para cambiar el backend" + "manageBackends": "Gestionar backends" }, "settingControl": { "default": "Predeterminado: {{value}}", diff --git a/resources/i18n/fr-FR/main.json b/resources/i18n/fr-FR/main.json index 7053a56f7..781a6499d 100644 --- a/resources/i18n/fr-FR/main.json +++ b/resources/i18n/fr-FR/main.json @@ -1105,8 +1105,7 @@ "cancel": "Annuler" }, "overviewHeader": { - "manageBackends": "Gérer les Backends", - "backendSwitchAria": "Mode actuel : {{title}} - Cliquer pour changer de backend" + "manageBackends": "Gérer les Backends" }, "settingControl": { "default": "Défaut : {{value}}", diff --git a/resources/i18n/ja-JP/main.json b/resources/i18n/ja-JP/main.json index a3cab80bc..830dbe361 100644 --- a/resources/i18n/ja-JP/main.json +++ b/resources/i18n/ja-JP/main.json @@ -1097,8 +1097,7 @@ "cancel": "キャンセル" }, "overviewHeader": { - "manageBackends": "バックエンドの管理", - "backendSwitchAria": "現在のモード: {{title}} - クリックしてバックエンドを切り替え" + "manageBackends": "バックエンドの管理" }, "settingControl": { "default": "デフォルト: {{value}}", diff --git a/resources/i18n/pt-BR/main.json b/resources/i18n/pt-BR/main.json index 268146675..341d45494 100644 --- a/resources/i18n/pt-BR/main.json +++ b/resources/i18n/pt-BR/main.json @@ -1105,8 +1105,7 @@ "cancel": "Cancelar" }, "overviewHeader": { - "manageBackends": "Gerenciar Backends", - "backendSwitchAria": "Modo atual: {{title}} - Clique para alterar o backend" + "manageBackends": "Gerenciar Backends" }, "settingControl": { "default": "Padrão: {{value}}", diff --git a/resources/i18n/ru-RU/main.json b/resources/i18n/ru-RU/main.json index d44fdb35e..7ee1ae3a5 100644 --- a/resources/i18n/ru-RU/main.json +++ b/resources/i18n/ru-RU/main.json @@ -1121,8 +1121,7 @@ "cancel": "Отмена" }, "overviewHeader": { - "manageBackends": "Управление бэкендами", - "backendSwitchAria": "Текущий режим: {{title}} - нажмите, чтобы сменить бэкенд" + "manageBackends": "Управление бэкендами" }, "settingControl": { "default": "По умолчанию: {{value}}", diff --git a/resources/i18n/sk-SK/main.json b/resources/i18n/sk-SK/main.json index e28c65de4..2eb103eab 100644 --- a/resources/i18n/sk-SK/main.json +++ b/resources/i18n/sk-SK/main.json @@ -1113,8 +1113,7 @@ "cancel": "Zrušiť" }, "overviewHeader": { - "manageBackends": "Spravovať backendy", - "backendSwitchAria": "Aktuálny režim: {{title}} – kliknutím prepnete backend" + "manageBackends": "Spravovať backendy" }, "settingControl": { "default": "Predvolené: {{value}}", diff --git a/resources/i18n/tr-TR/main.json b/resources/i18n/tr-TR/main.json index a0c56a440..3cc3beded 100644 --- a/resources/i18n/tr-TR/main.json +++ b/resources/i18n/tr-TR/main.json @@ -1105,8 +1105,7 @@ "cancel": "İptal" }, "overviewHeader": { - "manageBackends": "Arka Uçları Yönet", - "backendSwitchAria": "Mevcut mod: {{title}} - Arka uç değiştirmek için tıklayın" + "manageBackends": "Arka Uçları Yönet" }, "settingControl": { "default": "Varsayılan: {{value}}", diff --git a/resources/i18n/uk-UA/main.json b/resources/i18n/uk-UA/main.json index 0fad31b74..bbb46ddb1 100644 --- a/resources/i18n/uk-UA/main.json +++ b/resources/i18n/uk-UA/main.json @@ -1121,8 +1121,7 @@ "cancel": "Скасувати" }, "overviewHeader": { - "manageBackends": "Керувати бекендами", - "backendSwitchAria": "Поточний режим: {{title}} - натисніть, щоб перемкнути бекенд" + "manageBackends": "Керувати бекендами" }, "settingControl": { "default": "Типово: {{value}}", diff --git a/resources/i18n/zh-CN/main.json b/resources/i18n/zh-CN/main.json index 1e70043ad..6a5da564f 100644 --- a/resources/i18n/zh-CN/main.json +++ b/resources/i18n/zh-CN/main.json @@ -1097,8 +1097,7 @@ "cancel": "取消" }, "overviewHeader": { - "manageBackends": "管理后端", - "backendSwitchAria": "当前模式:{{title}} - 点击切换后端" + "manageBackends": "管理后端" }, "settingControl": { "default": "默认值:{{value}}", diff --git a/resources/i18n/zh-TW/main.json b/resources/i18n/zh-TW/main.json index 76983d6f8..71843ddad 100644 --- a/resources/i18n/zh-TW/main.json +++ b/resources/i18n/zh-TW/main.json @@ -1097,8 +1097,7 @@ "cancel": "取消" }, "overviewHeader": { - "manageBackends": "管理後端", - "backendSwitchAria": "當前模式:{{title}} - 點選切換後端" + "manageBackends": "管理後端" }, "settingControl": { "default": "預設值:{{value}}", diff --git a/src/app/features/components/dashboard/general-detail/general-detail.component.html b/src/app/features/components/dashboard/general-detail/general-detail.component.html index 772398092..55f7177fd 100755 --- a/src/app/features/components/dashboard/general-detail/general-detail.component.html +++ b/src/app/features/components/dashboard/general-detail/general-detail.component.html @@ -26,7 +26,6 @@

{{ remote.name }} diff --git a/src/app/features/components/dashboard/general-detail/general-detail.component.spec.ts b/src/app/features/components/dashboard/general-detail/general-detail.component.spec.ts index 18a6f7e69..a5523a988 100644 --- a/src/app/features/components/dashboard/general-detail/general-detail.component.spec.ts +++ b/src/app/features/components/dashboard/general-detail/general-detail.component.spec.ts @@ -78,6 +78,8 @@ describe('GeneralDetailComponent controls', () => { const start = vi.spyOn(fixture.componentInstance.startJob, 'emit'); expect(button.textContent?.trim()).toBe('Mount'); expect(button.title).toBe('Mount'); + // Named by its visible text, so speech input can say what it shows; the tooltip describes it. + expect(button.hasAttribute('aria-label')).toBe(false); expect(button.tagName).toBe('BUTTON'); expect(button.getAttribute('aria-pressed')).toBe('false'); button.click(); diff --git a/src/app/features/components/dashboard/general-detail/general-detail.component.ts b/src/app/features/components/dashboard/general-detail/general-detail.component.ts index 11f328fcb..31317d4c9 100755 --- a/src/app/features/components/dashboard/general-detail/general-detail.component.ts +++ b/src/app/features/components/dashboard/general-detail/general-detail.component.ts @@ -45,7 +45,7 @@ import { AutomationService } from 'src/app/services/operations/automation.servic import { WorkflowStorageService } from 'src/app/services/flow/workflow-storage.service'; import { RemoteFacadeService } from 'src/app/services/facade/remote-facade.service'; import { PathService } from 'src/app/services/infrastructure/platform/path.service'; -import { TranslatePipe, TranslateService } from '@ngx-translate/core'; +import { TranslatePipe } from '@ngx-translate/core'; import { MatDialog } from '@angular/material/dialog'; import { ItemOrderVisibilityModalComponent, @@ -83,7 +83,6 @@ export class GeneralDetailComponent { protected readonly statusIndicatorMeta = STATUS_INDICATOR_META; protected readonly iconService = inject(IconService); private readonly automationService = inject(AutomationService); - private readonly translate = inject(TranslateService); private readonly remoteFacade = inject(RemoteFacadeService); private readonly quickRunService = inject(QuickRunService); private readonly workflowStorage = inject(WorkflowStorageService); @@ -208,7 +207,6 @@ export class GeneralDetailComponent { const isActive = config.getActiveState(remote); const tooltip = isActive ? meta.stopTooltip : meta.startTooltip; const icon = isActive ? meta.stopIcon : meta.startIcon; - const ariaLabel = this.translate.instant(tooltip); const isLoading = isOperationActionInProgress(actions, key); @@ -222,7 +220,6 @@ export class GeneralDetailComponent { canInteract: !isLoading, isLoading, tooltip, - ariaLabel, }); }); return models; diff --git a/src/app/features/components/dashboard/general-overview/general-overview.component.html b/src/app/features/components/dashboard/general-overview/general-overview.component.html index ef03aba58..29c7ac4e3 100755 --- a/src/app/features/components/dashboard/general-overview/general-overview.component.html +++ b/src/app/features/components/dashboard/general-overview/general-overview.component.html @@ -13,7 +13,7 @@ -
+
RClone Manager

} -
+
@for (item of navItems; track item.viewId) { -
+
@for (item of bottomNavItems; track item.viewId; let last = $last) { - diff --git a/src/app/features/modals/settings/about-modal/about-modal.component.spec.ts b/src/app/features/modals/settings/about-modal/about-modal.component.spec.ts index 91aef0c82..51bcf76e9 100644 --- a/src/app/features/modals/settings/about-modal/about-modal.component.spec.ts +++ b/src/app/features/modals/settings/about-modal/about-modal.component.spec.ts @@ -1,4 +1,5 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'; +import { axeViolations } from 'src/testing/axe'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogRef } from '@angular/material/dialog'; import { provideTranslateService } from '@ngx-translate/core'; @@ -237,6 +238,12 @@ describe('AboutModalComponent', () => { expect((fixture.nativeElement as HTMLElement).querySelector('.platform-badge')).toBeNull(); }); + it('lists its pages as plain buttons, not as tabs', async () => { + const list = (fixture.nativeElement as HTMLElement).querySelector('.about-list') as HTMLElement; + expect(list.querySelector('[role="tablist"], [role="tab"], [aria-selected]')).toBeNull(); + expect(await axeViolations(list)).toEqual([]); + }); + it('should initialize successfully', () => { expect(component).toBeTruthy(); expect(component.rCloneManagerVersion).toBeDefined(); diff --git a/src/app/features/modals/settings/rclone-flags-modal/rclone-flags-modal.component.html b/src/app/features/modals/settings/rclone-flags-modal/rclone-flags-modal.component.html index 5b20761af..77c14f7e4 100755 --- a/src/app/features/modals/settings/rclone-flags-modal/rclone-flags-modal.component.html +++ b/src/app/features/modals/settings/rclone-flags-modal/rclone-flags-modal.component.html @@ -156,7 +156,7 @@ data-tone="warn" (click)="resetAllOptions()" [disabled]="isResetting()" - [attr.aria-label]="'modals.rcloneFlags.reset.aria' | translate" + [attr.title]="'modals.rcloneFlags.reset.aria' | translate" > @if (isResetting()) { diff --git a/src/app/file-browser/nautilus/nautilus.component.html b/src/app/file-browser/nautilus/nautilus.component.html index 196dbfc21..d67221ab6 100644 --- a/src/app/file-browser/nautilus/nautilus.component.html +++ b/src/app/file-browser/nautilus/nautilus.component.html @@ -50,12 +50,10 @@ > - - - @if (isPageView()) { -

{{ 'titlebar.menu.fileBrowser' | translate }}

- } + + +

{{ 'titlebar.menu.fileBrowser' | translate }}

{ const roots: ExplorerRoot[] = [ @@ -292,27 +292,3 @@ describe('Nautilus split divider gestures', () => { expect(document.body.style.cursor).toBe('crosshair'); }); }); - -describe('Nautilus page landmark', () => { - const base = { - picker: false, - standaloneWindow: false, - defaultView: 'main_menu', - overlayOpen: false, - }; - - it('is the page in its own window and as the default view', () => { - expect(isNautilusPageView({ ...base, standaloneWindow: true })).toBe(true); - expect(isNautilusPageView({ ...base, defaultView: 'nautilus' })).toBe(true); - }); - - it('is not the page as an overlay above the main UI, which keeps its own main landmark', () => { - expect(isNautilusPageView({ ...base, overlayOpen: true })).toBe(false); - expect(isNautilusPageView({ ...base, defaultView: 'nautilus', overlayOpen: true })).toBe(false); - }); - - it('is never the page as a file picker', () => { - expect(isNautilusPageView({ ...base, picker: true, standaloneWindow: true })).toBe(false); - expect(isNautilusPageView({ ...base, picker: true, defaultView: 'nautilus' })).toBe(false); - }); -}); diff --git a/src/app/file-browser/nautilus/nautilus.component.ts b/src/app/file-browser/nautilus/nautilus.component.ts index 71d45a767..90fe27af7 100755 --- a/src/app/file-browser/nautilus/nautilus.component.ts +++ b/src/app/file-browser/nautilus/nautilus.component.ts @@ -59,20 +59,6 @@ import { NautilusBottomBarComponent } from './bottom-bar/nautilus-bottom-bar.com import { AndroidShareService } from 'src/app/services/ui/android-share.service'; import { NautilusContextMenuComponent } from './context-menu/nautilus-context-menu.component'; -/** - * Whether the file browser is the page itself (its own window, or the default view) rather - * than a picker or an overlay above the main UI, which already has the page's main landmark. - */ -export function isNautilusPageView(state: { - picker: boolean; - standaloneWindow: boolean; - defaultView: string; - overlayOpen: boolean; -}): boolean { - if (state.picker) return false; - return state.standaloneWindow || (state.defaultView === 'nautilus' && !state.overlayOpen); -} - @Component({ selector: 'app-nautilus', changeDetection: ChangeDetectionStrategy.OnPush, @@ -159,14 +145,6 @@ export class NautilusComponent implements OnInit { this.uiStateService.activeWorkspace() === 'nautilus' ); }); - protected readonly isPageView = computed(() => - isNautilusPageView({ - picker: this.isPickerMode(), - standaloneWindow: this.nautilusService.isStandaloneWindow(), - defaultView: this.uiStateService.defaultView(), - overlayOpen: this.nautilusService.isBrowserOverlayOpen(), - }) - ); protected readonly pickerOptions = computed( (): FilePickerConfig => this.filePickerState().options ?? DEFAULT_PICKER_OPTIONS ); diff --git a/src/app/flow/quick-run/quick-run-overview/quick-run-overview.component.html b/src/app/flow/quick-run/quick-run-overview/quick-run-overview.component.html index 4c7538c8a..6f4be0b90 100644 --- a/src/app/flow/quick-run/quick-run-overview/quick-run-overview.component.html +++ b/src/app/flow/quick-run/quick-run-overview/quick-run-overview.component.html @@ -14,7 +14,7 @@ -
+
diff --git a/src/app/layout/titlebar/titlebar.component.html b/src/app/layout/titlebar/titlebar.component.html index 7407baa45..131662186 100644 --- a/src/app/layout/titlebar/titlebar.component.html +++ b/src/app/layout/titlebar/titlebar.component.html @@ -88,12 +88,7 @@
@for (item of addRemoteMenuItems; track item.label) { - diff --git a/src/app/shared/overviews-shared/overview-header/overview-header.component.html b/src/app/shared/overviews-shared/overview-header/overview-header.component.html index ff053e082..6abb5f600 100644 --- a/src/app/shared/overviews-shared/overview-header/overview-header.component.html +++ b/src/app/shared/overviews-shared/overview-header/overview-header.component.html @@ -3,14 +3,11 @@ class="header-btn" (click)="openBackendModal.emit()" [attr.title]="'shared.overviewHeader.manageBackends' | translate" - [attr.aria-label]=" - 'shared.overviewHeader.backendSwitchAria' | translate: { title: title() | translate } - " >
@if (mode() === 'general') { - + } @else { } diff --git a/src/app/shared/overviews-shared/overview-header/overview-header.component.spec.ts b/src/app/shared/overviews-shared/overview-header/overview-header.component.spec.ts index d17a427d7..baaaefd86 100644 --- a/src/app/shared/overviews-shared/overview-header/overview-header.component.spec.ts +++ b/src/app/shared/overviews-shared/overview-header/overview-header.component.spec.ts @@ -23,7 +23,7 @@ describe('OverviewHeaderComponent', () => { translate.setTranslation('en', { overviews: { headers: { general: 'RClone Manager', mount: 'Mount Overview' } }, shared: { - overviewHeader: { backendSwitchAria: 'Current mode: {{title}} - Click to switch backend' }, + overviewHeader: { manageBackends: 'Manage Backends' }, }, }); translate.use('en'); @@ -33,18 +33,18 @@ describe('OverviewHeaderComponent', () => { return fixture.nativeElement as HTMLElement; }; - it('names the backend switch with the translated title, not its key', () => { - const button = render('mount').querySelector('.header-btn'); - expect(button?.getAttribute('aria-label')).toBe( - 'Current mode: Mount Overview - Click to switch backend' - ); + it('names the backend switch with its visible title and backend, not a key', () => { + const button = render('mount').querySelector('.header-btn') as HTMLElement; + // No aria-label: the name is the visible text, so speech input can say what it sees. + expect(button.hasAttribute('aria-label')).toBe(false); + expect(button.querySelector('.header-title')?.textContent?.trim()).toBe('Mount Overview'); + expect(button.querySelector('.backend-label')?.textContent?.trim()).toBe('Local'); + expect(button.getAttribute('title')).toBe('Manage Backends'); }); - it('shows the same translated title it announces', () => { + it('does not repeat the title through the logo', () => { const header = render('general'); expect(header.querySelector('.header-title')?.textContent?.trim()).toBe('RClone Manager'); - expect(header.querySelector('.header-btn')?.getAttribute('aria-label')).toContain( - 'Current mode: RClone Manager' - ); + expect(header.querySelector('.app-logo')?.getAttribute('alt')).toBe(''); }); }); diff --git a/src/app/shared/overviews-shared/remote-card/remote-card.component.html b/src/app/shared/overviews-shared/remote-card/remote-card.component.html index a1ef831c8..b3c6265ef 100755 --- a/src/app/shared/overviews-shared/remote-card/remote-card.component.html +++ b/src/app/shared/overviews-shared/remote-card/remote-card.component.html @@ -25,9 +25,9 @@ >
-

+

{{ remote().name }} -

+ {{ remote().type | titlecase }}
diff --git a/src/app/shared/overviews-shared/remote-card/remote-card.component.spec.ts b/src/app/shared/overviews-shared/remote-card/remote-card.component.spec.ts index 2427fc629..e7ac443f0 100644 --- a/src/app/shared/overviews-shared/remote-card/remote-card.component.spec.ts +++ b/src/app/shared/overviews-shared/remote-card/remote-card.component.spec.ts @@ -88,6 +88,11 @@ describe('RemoteCardComponent', () => { const host = (): HTMLElement => fixture.nativeElement; + it('titles the remote one level below the overview heading', () => { + // The overview header is an h2, so the card names are h3s. + expect(host().querySelector('h3.card-name')?.textContent?.trim()).toBe(createMockRemote().name); + }); + it('is idle, primary-toned and not marked active when nothing is running', () => { expect(component.isActive()).toBe(false); expect(component.cardTone()).toBe('primary'); diff --git a/src/app/shared/types/ui.ts b/src/app/shared/types/ui.ts index 93b4c9c47..1f541a171 100755 --- a/src/app/shared/types/ui.ts +++ b/src/app/shared/types/ui.ts @@ -342,7 +342,6 @@ export interface ActionViewModel { position: number; canInteract: boolean; tooltip: string; - ariaLabel: string; isLoading?: boolean; } diff --git a/src/testing/axe.spec.ts b/src/testing/axe.spec.ts index 957b2cf34..0b9904be9 100644 --- a/src/testing/axe.spec.ts +++ b/src/testing/axe.spec.ts @@ -25,7 +25,6 @@ function useEnglish(): void { shared: { overviewHeader: { manageBackends: 'Manage Backends', - backendSwitchAria: 'Current mode: {{title}} - Click to switch backend', }, }, generalOverview: { layout: { edit: 'Edit Layout' } },