[PR #5652] [MERGED] feat(a11y): screen-reader & keyboard accessibility across the panel (#5486) #5949

Closed
opened 2026-11-02 04:05:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5652
Author: @nima1024m
Created: 6/29/2026
Status: ✅ Merged
Merged: 6/29/2026
Merged by: @MHSanaei

Base: main ← Head: feat/accessibility-screen-reader


📝 Commits (9)

  • fdac307 feat(a11y): label list, toolbar & dashboard actions for screen readers
  • 2a4544f feat(a11y): label modal, QR and copy/download controls for screen readers
  • ff96941 feat(a11y): label form fields and shared form components for screen readers
  • 01a016f chore(a11y): add eslint-plugin-jsx-a11y harness and fix flagged interactions
  • 7198a66 feat(a11y): cover remaining deferred spots (settings tabs, sockopt, API docs)
  • 615bb32 feat(a11y): label shared xray form components and remark field
  • 74c9f55 feat(a11y): label client info modal and WireGuard config block
  • e4e862b fix(frontend): let npm install jsx-a11y under ESLint 10
  • 7aeca55 fix(a11y): size mobile row triggers and move node expand role to chevron

📊 Changes

82 files changed (+2080 additions, -266 deletions)

View changed files

📝 frontend/eslint.config.js (+9 -0)
📝 frontend/package-lock.json (+1376 -8)
📝 frontend/package.json (+4 -0)
📝 frontend/src/components/clients/ConfigBlock.tsx (+4 -2)
📝 frontend/src/components/form/DateTimePicker.tsx (+3 -1)
📝 frontend/src/components/form/HeaderMapEditor.tsx (+3 -1)
📝 frontend/src/components/form/JsonEditor.tsx (+3 -1)
📝 frontend/src/components/form/RemarkTemplateField.tsx (+1 -1)
📝 frontend/src/components/form/RemarkVarPicker.tsx (+4 -0)
📝 frontend/src/components/ui/InputAddon.tsx (+7 -1)
📝 frontend/src/components/ui/SettingListItem.tsx (+8 -3)
📝 frontend/src/components/ui/notifications/NotificationHeader.tsx (+3 -1)
📝 frontend/src/components/viz/Sparkline.tsx (+11 -1)
📝 frontend/src/layouts/AppSidebar.tsx (+1 -1)
📝 frontend/src/lib/xray/forms/SniffingFields.tsx (+6 -1)
📝 frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx (+6 -0)
📝 frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx (+71 -7)
📝 frontend/src/pages/api-docs/ApiDocsPage.tsx (+3 -1)
📝 frontend/src/pages/clients/ClientBulkAddModal.tsx (+1 -0)
📝 frontend/src/pages/clients/ClientFormModal.tsx (+12 -10)

...and 62 more files

📄 Description

Implements panel-wide screen-reader (Android TalkBack) and keyboard accessibility for upstream issue MHSanaei/3x-ui#5486.

What changed

Icon-only buttons across the panel previously announced only their untranslated icon name (e.g. "edit", "ellipsis") or nothing, and several clickable elements (mobile card actions, dashboard cards, drag handles, QR codes, list remove-icons) were not keyboard-operable. This adds proper accessible names and keyboard support across every management surface, without changing any visual or mouse behavior.

Built from a panel-wide audit, split into reviewable commits:

  • Lists, toolbars & dashboard — aria-labels on row-action/toolbar icon buttons (inbounds, clients, groups, hosts, nodes, xray outbounds/routing/dns/balancers) and dashboard cards; sidebar hamburger mislabel fixed.
  • Modals, QR & copy panels — info modals, QR panel, sub-links, log/backup/version modals, 2FA; click-to-copy QR codes made keyboard-operable.
  • Forms & shared components — SettingListItem now labels the ~90 settings-tab inputs via aria-labelledby; InputAddon remove controls are keyboard-operable; form add/remove/regenerate buttons and bare inputs labeled; decorative icons aria-hidden; charts exposed as labeled images.
  • Shared xray forms — FinalMaskForm, CustomSockoptList, SniffingFields, and the WireGuard ConfigBlock (used by the host/inbound/client forms).
  • Lint harness (dev-only) — eslint-plugin-jsx-a11y (flat-config recommended ruleset) so accessibility regressions fail npm run lint. This is a lint-time tool only: it is not bundled and does not affect the built panel — the shipped accessibility is the aria-*/role/tabIndex attributes added to the JSX.

A small shared activateOnKey helper (src/utils/a11y.ts) provides Enter/Space activation for non-button clickable elements.

Rebased onto current main (includes the WireGuard client-config feature); its restructured ClientInfoModal and new ConfigBlock are labelled too.

Internationalization

12 new i18n keys added to all 13 locale files with real translations (not English fallbacks): sort, regenerate, jsonEditor, downloadImage, menu.openMenu, pages.xray.outbound.moveToTop, pages.xray.balancer.{costMatch,costValue,costRegexp}, pages.settings.notifyTime.{interval,unit}, pages.inbounds.sniffingDestOverride. Everything else reuses existing keys. Three previously-hardcoded English outbound menu labels are now translated.

Dependency note: jsx-a11y on ESLint 10

eslint-plugin-jsx-a11y@6.10.2 (its latest release) declares a peer range that stops at ESLint 9, while this panel is on ESLint 10. The plugin itself runs fine on ESLint 10 through flat config (flatConfigs.recommended) — the peer range is simply stale — but the version mismatch makes a clean npm ci abort with ERESOLVE. This is resolved with a single npm overrides entry so the plugin accepts the project's ESLint version:

"overrides": {
  "eslint-plugin-jsx-a11y": { "eslint": "$eslint" }
}

This is surgical: it only relaxes jsx-a11y's eslint peer and leaves normal peer resolution intact, so recharts' react-is peer still auto-installs. No legacy-peer-deps, no other dependency changes.

Verification

  • npm run typecheck, npm run lint (jsx-a11y enforced — 0 errors), npm run build, npm run test (616/616), make gen (no diff).
  • CI on the fork is green across all jobs (frontend, multi-arch builds, CodeQL analyze, go-test, golangci, govulncheck, race, codegen).
  • Multi-angle code review found no correctness regressions to normal (non-accessibility) functionality: the stop-propagation removals, QR onClick relocations, dropdown-trigger conversions and shared-component changes were each traced safe across their call sites.
  • Locale completeness verified by script: every referenced t() key resolves in en-US; all 12 new keys present as strings in all 13 locales.

Notes

  • All changes are additive (aria-* / role / tabIndex / onKeyDown) and do not alter mouse/visual behavior.
  • jsx-a11y/no-autofocus is disabled deliberately — autofocus on the login field and modal primary inputs is intentional focus management that helps screen-reader and keyboard users land on the right control.
  • Possible follow-up (intentionally not done here, to avoid large late churn): extract the repeated role/tabIndex/aria-label/onClick/onKeyDown icon pattern (~34 sites) into a small ClickableIcon component.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5652 **Author:** [@nima1024m](https://github.com/nima1024m) **Created:** 6/29/2026 **Status:** ✅ Merged **Merged:** 6/29/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/accessibility-screen-reader` --- ### 📝 Commits (9) - [`fdac307`](https://github.com/MHSanaei/3x-ui/commit/fdac3078daa12b837b5356f9f697e6969e638309) feat(a11y): label list, toolbar & dashboard actions for screen readers - [`2a4544f`](https://github.com/MHSanaei/3x-ui/commit/2a4544f0834181e1528aae1957edc127d37269bd) feat(a11y): label modal, QR and copy/download controls for screen readers - [`ff96941`](https://github.com/MHSanaei/3x-ui/commit/ff96941dbf68862cff484bffd2de210e18b14405) feat(a11y): label form fields and shared form components for screen readers - [`01a016f`](https://github.com/MHSanaei/3x-ui/commit/01a016f059a69c8d85e2a38ecd730dbaa9c6e8d7) chore(a11y): add eslint-plugin-jsx-a11y harness and fix flagged interactions - [`7198a66`](https://github.com/MHSanaei/3x-ui/commit/7198a669b4ee4af74f67216b54c0dcb9fe43d15a) feat(a11y): cover remaining deferred spots (settings tabs, sockopt, API docs) - [`615bb32`](https://github.com/MHSanaei/3x-ui/commit/615bb32658303a311e110a8cda740ea9791f201a) feat(a11y): label shared xray form components and remark field - [`74c9f55`](https://github.com/MHSanaei/3x-ui/commit/74c9f554ac71803cdeccb932fc740a0e6774b1eb) feat(a11y): label client info modal and WireGuard config block - [`e4e862b`](https://github.com/MHSanaei/3x-ui/commit/e4e862b3310cfebc84200477736562fd96d0f0da) fix(frontend): let npm install jsx-a11y under ESLint 10 - [`7aeca55`](https://github.com/MHSanaei/3x-ui/commit/7aeca558d869425c2a205ab9b788dae43ccd0dd9) fix(a11y): size mobile row triggers and move node expand role to chevron ### 📊 Changes **82 files changed** (+2080 additions, -266 deletions) <details> <summary>View changed files</summary> 📝 `frontend/eslint.config.js` (+9 -0) 📝 `frontend/package-lock.json` (+1376 -8) 📝 `frontend/package.json` (+4 -0) 📝 `frontend/src/components/clients/ConfigBlock.tsx` (+4 -2) 📝 `frontend/src/components/form/DateTimePicker.tsx` (+3 -1) 📝 `frontend/src/components/form/HeaderMapEditor.tsx` (+3 -1) 📝 `frontend/src/components/form/JsonEditor.tsx` (+3 -1) 📝 `frontend/src/components/form/RemarkTemplateField.tsx` (+1 -1) 📝 `frontend/src/components/form/RemarkVarPicker.tsx` (+4 -0) 📝 `frontend/src/components/ui/InputAddon.tsx` (+7 -1) 📝 `frontend/src/components/ui/SettingListItem.tsx` (+8 -3) 📝 `frontend/src/components/ui/notifications/NotificationHeader.tsx` (+3 -1) 📝 `frontend/src/components/viz/Sparkline.tsx` (+11 -1) 📝 `frontend/src/layouts/AppSidebar.tsx` (+1 -1) 📝 `frontend/src/lib/xray/forms/SniffingFields.tsx` (+6 -1) 📝 `frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx` (+6 -0) 📝 `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx` (+71 -7) 📝 `frontend/src/pages/api-docs/ApiDocsPage.tsx` (+3 -1) 📝 `frontend/src/pages/clients/ClientBulkAddModal.tsx` (+1 -0) 📝 `frontend/src/pages/clients/ClientFormModal.tsx` (+12 -10) _...and 62 more files_ </details> ### 📄 Description Implements panel-wide screen-reader (Android TalkBack) and keyboard accessibility for upstream issue MHSanaei/3x-ui#5486. ## What changed Icon-only buttons across the panel previously announced only their untranslated icon name (e.g. "edit", "ellipsis") or nothing, and several clickable elements (mobile card actions, dashboard cards, drag handles, QR codes, list remove-icons) were not keyboard-operable. This adds proper accessible names and keyboard support across every management surface, **without changing any visual or mouse behavior**. Built from a panel-wide audit, split into reviewable commits: - **Lists, toolbars & dashboard** — aria-labels on row-action/toolbar icon buttons (inbounds, clients, groups, hosts, nodes, xray outbounds/routing/dns/balancers) and dashboard cards; sidebar hamburger mislabel fixed. - **Modals, QR & copy panels** — info modals, QR panel, sub-links, log/backup/version modals, 2FA; click-to-copy QR codes made keyboard-operable. - **Forms & shared components** — `SettingListItem` now labels the ~90 settings-tab inputs via `aria-labelledby`; `InputAddon` remove controls are keyboard-operable; form add/remove/regenerate buttons and bare inputs labeled; decorative icons `aria-hidden`; charts exposed as labeled images. - **Shared xray forms** — `FinalMaskForm`, `CustomSockoptList`, `SniffingFields`, and the WireGuard `ConfigBlock` (used by the host/inbound/client forms). - **Lint harness (dev-only)** — `eslint-plugin-jsx-a11y` (flat-config recommended ruleset) so accessibility regressions fail `npm run lint`. This is a lint-time tool only: it is not bundled and does not affect the built panel — the shipped accessibility is the `aria-*`/`role`/`tabIndex` attributes added to the JSX. A small shared `activateOnKey` helper (`src/utils/a11y.ts`) provides Enter/Space activation for non-button clickable elements. > Rebased onto current `main` (includes the WireGuard client-config feature); its restructured `ClientInfoModal` and new `ConfigBlock` are labelled too. ## Internationalization 12 new i18n keys added to **all 13 locale files** with real translations (not English fallbacks): `sort`, `regenerate`, `jsonEditor`, `downloadImage`, `menu.openMenu`, `pages.xray.outbound.moveToTop`, `pages.xray.balancer.{costMatch,costValue,costRegexp}`, `pages.settings.notifyTime.{interval,unit}`, `pages.inbounds.sniffingDestOverride`. Everything else reuses existing keys. Three previously-hardcoded English outbound menu labels are now translated. ## Dependency note: jsx-a11y on ESLint 10 `eslint-plugin-jsx-a11y@6.10.2` (its latest release) declares a peer range that stops at **ESLint 9**, while this panel is on **ESLint 10**. The plugin itself runs fine on ESLint 10 through flat config (`flatConfigs.recommended`) — the peer range is simply stale — but the version mismatch makes a clean `npm ci` abort with `ERESOLVE`. This is resolved with a single npm `overrides` entry so the plugin accepts the project's ESLint version: ```json "overrides": { "eslint-plugin-jsx-a11y": { "eslint": "$eslint" } } ``` This is surgical: it only relaxes jsx-a11y's `eslint` peer and leaves normal peer resolution intact, so recharts' `react-is` peer still auto-installs. No `legacy-peer-deps`, no other dependency changes. ## Verification - `npm run typecheck`, `npm run lint` (jsx-a11y enforced — 0 errors), `npm run build`, `npm run test` (**616/616**), `make gen` (no diff). - CI on the fork is **green across all jobs** (frontend, multi-arch builds, CodeQL analyze, go-test, golangci, govulncheck, race, codegen). - Multi-angle code review found **no correctness regressions to normal (non-accessibility) functionality**: the stop-propagation removals, QR onClick relocations, dropdown-trigger conversions and shared-component changes were each traced safe across their call sites. - Locale completeness verified by script: every referenced `t()` key resolves in en-US; all 12 new keys present as strings in all 13 locales. ## Notes - All changes are additive (`aria-*` / `role` / `tabIndex` / `onKeyDown`) and do not alter mouse/visual behavior. - `jsx-a11y/no-autofocus` is disabled deliberately — autofocus on the login field and modal primary inputs is intentional focus management that helps screen-reader and keyboard users land on the right control. - Possible follow-up (intentionally not done here, to avoid large late churn): extract the repeated `role/tabIndex/aria-label/onClick/onKeyDown` icon pattern (~34 sites) into a small `ClickableIcon` component. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5949
No description provided.