[PR #6907] [MERGED] fix(frontend): make the panel usable with screen readers #6513

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6907
Author: @alireza0
Created: 10/23/2026
Status: ✅ Merged
Merged: 10/23/2026
Merged by: @alireza0

Base: main ← Head: fix/screen-reader-a11y


📝 Commits (2)

  • 9cfcf43 fix(frontend): make the panel usable with screen readers
  • 8302ff4 fix(frontend): keep mobile tab names and the inbound expiry hint

📊 Changes

156 files changed (+2373 additions, -863 deletions)

View changed files

📝 frontend/.oxlintrc.json (+25 -2)
📝 frontend/src/components/clients/ClientHwidList.tsx (+7 -2)
📝 frontend/src/components/clients/ConfigBlock.tsx (+12 -3)
📝 frontend/src/components/command-palette/CommandPalette.tsx (+39 -39)
📝 frontend/src/components/feedback/TextModal.tsx (+2 -2)
📝 frontend/src/components/form/DateTimePicker.tsx (+15 -2)
📝 frontend/src/components/form/HeaderMapEditor.tsx (+4 -2)
📝 frontend/src/components/form/RemarkTemplateField.tsx (+13 -1)
📝 frontend/src/components/form/rhf/FormField.tsx (+14 -2)
📝 frontend/src/components/geodata/GeoBrowserModal.tsx (+2 -0)
📝 frontend/src/components/geodata/GeoTokenInput.tsx (+4 -1)
📝 frontend/src/components/sponsor/SponsorCard.tsx (+3 -3)
📝 frontend/src/components/ui/notifications/DiscordNotifications.tsx (+5 -5)
📝 frontend/src/components/ui/notifications/EmailNotifications.tsx (+5 -5)
📝 frontend/src/components/ui/notifications/TelegramNotifications.tsx (+5 -5)
📝 frontend/src/entries/login.tsx (+8 -5)
📝 frontend/src/entries/subpage.tsx (+8 -5)
➕ frontend/src/i18n/AntdRootConfig.tsx (+41 -0)
📝 frontend/src/i18n/react.ts (+4 -0)
📝 frontend/src/layouts/AppSidebar.tsx (+43 -21)

...and 80 more files

📄 Description

Summary

Screen-reader users (NVDA, TalkBack) reported that the panel is hard to use: forms, buttons and menus are not announced properly. This ports the fix from alireza0/s-ui-frontend@7574c9d (alireza0/s-ui#1293) and covers the gaps that are specific to Ant Design.

What a screen reader got before this PR:

  • Wrong voice: <html lang="en"> on every locale, so Persian/Arabic/Chinese pages were read with an English voice.
  • Unnamed fields: about 150 form controls were announced as just "edit text" / "switch". Form.Item label without name is not tied to its control.
  • English icon names: every @ant-design/icons icon renders role="img" aria-label="<icon-name>", so you heard "plus Add client" or "Total traffic question-circle".
  • Unreachable hints: tooltip hints and status errors only appeared on mouse hover.
  • English antd UI: antd's own strings (empty states, close buttons, pagination) were English in every language.

Changes

  • Page language: readyI18n sets <html lang> to the active locale (panel, login and subscription page).
  • Form labels: htmlFor + useId ids tie labels to controls. Controls with no visible label get a translated aria-label.
  • Icons: decorative icons are aria-hidden (554 sites). Status icons (node error, subscription status) are named with their tooltip text, and spinners read "Loading…".
  • Hints: FormField exposes tooltip as aria-describedby, and the direct Form.Item tooltip sites do the same.
  • antd locale: new AntdRootConfig (root ConfigProvider) loads the antd locale for the panel language lazily and sets an aria-hidden label-tooltip icon for all forms.
  • Keyboard: the "update available" tag and the clients-table group tag work with Enter/Space.
  • Prop forwarding: DateTimePicker (both calendars), RemarkTemplateField, SecretInput, GeoTokenInput and TransformEditor forward id / aria props to their inputs.
  • i18n: 5 new keys in all 13 locales (pages.index.logLines, pages.index.timeRange, pages.inbounds.form.maxVersion, pages.inbounds.form.headerName, pages.inbounds.form.headerValue).
  • Regression guards: two oxlint JS plugins in frontend/tools/oxlint/, enabled for src/**/*.tsx (stories and tests excluded):
    • control-label/has-name: an antd form control with no accessible name, or a Form.Item label not tied to its control.
    • antd-icon/explicit-a11y: an antd icon with neither aria-hidden nor aria-label.

User-visible changes

  • antd's built-in strings now follow the panel language. DatePicker month names stay English: dayjs's global locale is left alone so date formatting elsewhere does not change.
  • Four labels that showed their hint on hovering the label text now have the standard ? tooltip icon (inbound Total Flow / Expiry, TUN auto system routes / auto outbounds interface). The eight routing-rule fields and six inbound fields that already had a ? icon now use antd's standard one.
  • Nothing else changes visually. Everything else is aria attributes or hidden description text.

Testing

  • npm run lint, npm run typecheck, oxfmt --check, npm run build: clean.
  • npm test: 1867 passed (198 files).
  • New tests, each checked to fail on the code before the fix:
    • document-lang, antd-locale, form-field-hint, rule-form-hints
    • date-time-picker-label, node-list-a11y, overview-update-tag-keyboard
    • fixture tests for both oxlint guards (control-label-guard, icon-a11y-guard)
  • Not tested with a real screen reader (NVDA/TalkBack) yet. The tests check names and descriptions through Testing Library's accessible-name computation.
  • make verify was not run as a whole. No Go code changed; the Go side only gets the new translation keys.

Not covered

  • The clients-table group tag keyboard fix has no test: ClientsPage has no test harness.
  • HeaderMapEditor rows are named per row ("Header name" / "Header value") but do not take the id from their parent label.

🔄 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/6907 **Author:** [@alireza0](https://github.com/alireza0) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@alireza0](https://github.com/alireza0) **Base:** `main` ← **Head:** `fix/screen-reader-a11y` --- ### 📝 Commits (2) - [`9cfcf43`](https://github.com/MHSanaei/3x-ui/commit/9cfcf43c8be94803f7a01c2407cf37f933b14d4e) fix(frontend): make the panel usable with screen readers - [`8302ff4`](https://github.com/MHSanaei/3x-ui/commit/8302ff4b805c0f81a878747d574d11767b0d031f) fix(frontend): keep mobile tab names and the inbound expiry hint ### 📊 Changes **156 files changed** (+2373 additions, -863 deletions) <details> <summary>View changed files</summary> 📝 `frontend/.oxlintrc.json` (+25 -2) 📝 `frontend/src/components/clients/ClientHwidList.tsx` (+7 -2) 📝 `frontend/src/components/clients/ConfigBlock.tsx` (+12 -3) 📝 `frontend/src/components/command-palette/CommandPalette.tsx` (+39 -39) 📝 `frontend/src/components/feedback/TextModal.tsx` (+2 -2) 📝 `frontend/src/components/form/DateTimePicker.tsx` (+15 -2) 📝 `frontend/src/components/form/HeaderMapEditor.tsx` (+4 -2) 📝 `frontend/src/components/form/RemarkTemplateField.tsx` (+13 -1) 📝 `frontend/src/components/form/rhf/FormField.tsx` (+14 -2) 📝 `frontend/src/components/geodata/GeoBrowserModal.tsx` (+2 -0) 📝 `frontend/src/components/geodata/GeoTokenInput.tsx` (+4 -1) 📝 `frontend/src/components/sponsor/SponsorCard.tsx` (+3 -3) 📝 `frontend/src/components/ui/notifications/DiscordNotifications.tsx` (+5 -5) 📝 `frontend/src/components/ui/notifications/EmailNotifications.tsx` (+5 -5) 📝 `frontend/src/components/ui/notifications/TelegramNotifications.tsx` (+5 -5) 📝 `frontend/src/entries/login.tsx` (+8 -5) 📝 `frontend/src/entries/subpage.tsx` (+8 -5) ➕ `frontend/src/i18n/AntdRootConfig.tsx` (+41 -0) 📝 `frontend/src/i18n/react.ts` (+4 -0) 📝 `frontend/src/layouts/AppSidebar.tsx` (+43 -21) _...and 80 more files_ </details> ### 📄 Description ## Summary Screen-reader users (NVDA, TalkBack) reported that the panel is hard to use: forms, buttons and menus are not announced properly. This ports the fix from alireza0/s-ui-frontend@7574c9d (alireza0/s-ui#1293) and covers the gaps that are specific to Ant Design. What a screen reader got before this PR: - **Wrong voice:** `<html lang="en">` on every locale, so Persian/Arabic/Chinese pages were read with an English voice. - **Unnamed fields:** about 150 form controls were announced as just "edit text" / "switch". `Form.Item label` without `name` is not tied to its control. - **English icon names:** every `@ant-design/icons` icon renders `role="img" aria-label="<icon-name>"`, so you heard "plus Add client" or "Total traffic question-circle". - **Unreachable hints:** tooltip hints and status errors only appeared on mouse hover. - **English antd UI:** antd's own strings (empty states, close buttons, pagination) were English in every language. ## Changes - **Page language:** `readyI18n` sets `<html lang>` to the active locale (panel, login and subscription page). - **Form labels:** `htmlFor` + `useId` ids tie labels to controls. Controls with no visible label get a translated `aria-label`. - **Icons:** decorative icons are `aria-hidden` (554 sites). Status icons (node error, subscription status) are named with their tooltip text, and spinners read "Loading…". - **Hints:** `FormField` exposes `tooltip` as `aria-describedby`, and the direct `Form.Item` tooltip sites do the same. - **antd locale:** new `AntdRootConfig` (root `ConfigProvider`) loads the antd locale for the panel language lazily and sets an `aria-hidden` label-tooltip icon for all forms. - **Keyboard:** the "update available" tag and the clients-table group tag work with Enter/Space. - **Prop forwarding:** `DateTimePicker` (both calendars), `RemarkTemplateField`, `SecretInput`, `GeoTokenInput` and `TransformEditor` forward `id` / aria props to their inputs. - **i18n:** 5 new keys in all 13 locales (`pages.index.logLines`, `pages.index.timeRange`, `pages.inbounds.form.maxVersion`, `pages.inbounds.form.headerName`, `pages.inbounds.form.headerValue`). - **Regression guards:** two oxlint JS plugins in `frontend/tools/oxlint/`, enabled for `src/**/*.tsx` (stories and tests excluded): - `control-label/has-name`: an antd form control with no accessible name, or a `Form.Item` label not tied to its control. - `antd-icon/explicit-a11y`: an antd icon with neither `aria-hidden` nor `aria-label`. ## User-visible changes - antd's built-in strings now follow the panel language. DatePicker month names stay English: dayjs's global locale is left alone so date formatting elsewhere does not change. - Four labels that showed their hint on hovering the label text now have the standard `?` tooltip icon (inbound Total Flow / Expiry, TUN auto system routes / auto outbounds interface). The eight routing-rule fields and six inbound fields that already had a `?` icon now use antd's standard one. - Nothing else changes visually. Everything else is aria attributes or hidden description text. ## Testing - `npm run lint`, `npm run typecheck`, `oxfmt --check`, `npm run build`: clean. - `npm test`: 1867 passed (198 files). - New tests, each checked to fail on the code before the fix: - `document-lang`, `antd-locale`, `form-field-hint`, `rule-form-hints` - `date-time-picker-label`, `node-list-a11y`, `overview-update-tag-keyboard` - fixture tests for both oxlint guards (`control-label-guard`, `icon-a11y-guard`) - Not tested with a real screen reader (NVDA/TalkBack) yet. The tests check names and descriptions through Testing Library's accessible-name computation. - `make verify` was not run as a whole. No Go code changed; the Go side only gets the new translation keys. ## Not covered - The clients-table group tag keyboard fix has no test: `ClientsPage` has no test harness. - `HeaderMapEditor` rows are named per row ("Header name" / "Header value") but do not take the `id` from their parent label. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:09:18 +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#6513
No description provided.