[PR #7025] [MERGED] fix(frontend): improve inbound form accessibility for screen readers #6585

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7025
Author: @HamedSanaei
Created: 10/29/2026
Status: ✅ Merged
Merged: 11/5/2026
Merged by: @MHSanaei

Base: main ← Head: codex/issue-7023-inbound-a11y


📝 Commits (4)

  • 823f149 fix(frontend): make inbound pickers screen-reader accessible
  • 290aeb1 chore: integrate current main for PR 7025 validation
  • 756134c Merge remote-tracking branch 'origin/main' into codex/review-pr-7025-20261105
  • f647d84 Merge remote-tracking branch 'origin/main' into codex/review-pr-7025-20261105

📊 Changes

29 files changed (+875 additions, -110 deletions)

View changed files

📝 .github/workflows/ci.yml (+9 -0)
📝 frontend/README.md (+27 -0)
➕ frontend/src/components/form/NativeSelect.css (+14 -0)
➕ frontend/src/components/form/NativeSelect.stories.tsx (+67 -0)
➕ frontend/src/components/form/NativeSelect.tsx (+70 -0)
📝 frontend/src/components/form/rhf/FormField.stories.tsx (+3 -0)
📝 frontend/src/components/form/rhf/FormField.tsx (+12 -9)
📝 frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx (+2 -1)
📝 frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx (+9 -8)
📝 frontend/src/lib/xray/forms/transport/XDriveForm.tsx (+2 -1)
➕ frontend/src/pages/inbounds/form/InboundFormModal.stories.tsx (+121 -0)
📝 frontend/src/pages/inbounds/form/InboundFormModal.tsx (+52 -8)
📝 frontend/src/pages/inbounds/form/protocols/hysteria.tsx (+3 -2)
📝 frontend/src/pages/inbounds/form/protocols/mixed.tsx (+3 -2)
📝 frontend/src/pages/inbounds/form/protocols/shadowsocks.tsx (+6 -3)
📝 frontend/src/pages/inbounds/form/protocols/tuic.tsx (+4 -3)
📝 frontend/src/pages/inbounds/form/protocols/tunnel.tsx (+3 -2)
📝 frontend/src/pages/inbounds/form/protocols/vless.tsx (+3 -2)
📝 frontend/src/pages/inbounds/form/security/reality.tsx (+4 -1)
📝 frontend/src/pages/inbounds/form/security/tls.tsx (+6 -5)

...and 9 more files

📄 Description

Refs #7023

Make the Create/Edit Inbound pickers expose actual selectable options and selected values, preserve their form behavior, and keep keyboard focus in the modal. Related reports: #6832 and #6107. The label/tooltip/localization work from #6907 is preserved.

Root cause and solution

Inspection of the installed Ant Design 6.6.7/rc-select implementation and rendered Chromium accessibility tree confirmed several separate gaps:

  • Default virtualization puts option semantics on a hidden three-item proxy. The visible rows users explore have no option role. With virtual={false}, rc-select does expose the actual list and selectable options, but its closed single-select combobox still has an empty value in Chromium's AX tree. It therefore does not fully solve the simple-picker problem.
  • Default popups are mounted outside the aria-modal dialog. Retained searchable/multi-select controls now render real options inside the inbound modal body, through a scoped ConfigProvider. The modal shell itself ignores pointer events, so the popup is deliberately placed in its interactive body.
  • Security's radio group had no accessible group name. RHF validation help was visible but not associated with the input.
  • Real Tab navigation could leave the document after the last modal button. The inbound modal now wraps Tab/Shift+Tab only at its first/last button boundaries, while retaining Ant Design's normal focus/close behavior and leaving popup focus alone.

Use a small, themed native <select> for the short single-value lists: Protocol, Transport, address strategy, reset schedule, encryption/auth type, and similar protocol/TLS/REALITY/transport fields. The browser owns their roles, selected-value semantics, keyboard interaction and mobile picker. No internal Select ARIA roles or active-descendant state are overridden.

NativeSelect forwards IDs, ARIA descriptions, blur and React 19 refs. Its private option keys map back to the original typed values, including numeric zero, strings and empty strings; disabled options/fields, dynamic lists and unlisted saved values are preserved. Existing onChange/onAfterChange handlers still receive the same values. It also supports the existing small preset control and Ant Design theme tokens.

Searchable, clearable, tag, autocomplete and multi-select controls remain Ant Design controls. There is no application-wide change to Ant Design defaults. The fixed-choice controls in the shared FinalMask, CustomSockopt and XDrive editors use the same native primitive because these editors are part of the inbound workflow; their outbound consumers are covered by the full regression suite.

Modified components/files

  • frontend/src/components/form/NativeSelect.{tsx,css,stories.tsx}: native single selection and typed-value browser example.
  • frontend/src/components/form/rhf/FormField.{tsx,stories.tsx}: merge existing descriptions, tooltip, extra guidance and translated validation help; expose invalid state without replacing a caller's ARIA props.
  • frontend/src/pages/inbounds/form/InboundFormModal.{tsx,stories.tsx}: basic/transport pickers, scoped complex-control options, named Security group, keyboard boundaries and real add/edit fixtures.
  • Inbound protocol fields: hysteria.tsx, mixed.tsx, shadowsocks.tsx, tuic.tsx, tunnel.tsx, vless.tsx.
  • Inbound security fields: security/reality.tsx, security/tls.tsx; transport fields: transport/sockopt.tsx, transport/xhttp.tsx.
  • Shared editors: frontend/src/lib/xray/forms/transport/{CustomSockoptList,FinalMaskForm,XDriveForm}.tsx.
  • Regression tests: native-select.test.tsx, inbound-form-accessibility.test.tsx, rhf-form-field.test.tsx; adapt the existing inbound/outbound tests and test-utils.tsx to operate real native options instead of requiring Ant Design CSS markup. Remove the old crash-only inbound assertion and strengthen the existing protocol-shape assertion.
  • frontend/tools/check-inbound-keyboard.mjs, the frontend CI job, and frontend/README.md: repeatable trusted-keyboard/AX/request checks and the real-screen-reader verification checklist.

Behavior preserved

Protocol availability and option values, edit-mode protocol disabling, localization, defaults/conditional fields, transport resets and security side effects are unchanged. Existing schema validation and form-to-wire adapters are untouched. Edit payloads still omit server-owned clients. No Go, API contract, database, quota/expiry/client setting or Xray configuration generation changes; no new dependency or translation key.

Automated verification

  • Test first: the real modal initially failed option/list ownership and named Security checks; RHF validation had no accessible description. A separate reproduction then showed the selected protocol's closed value was empty even with non-virtual Ant Design options. These were recorded red before their fixes.
  • make verify: PASS, including code generation freshness, Go lint/tests/build, frontend lint/format/typecheck, 2,030 tests across 219 files, production Vite build, Storybook build and matching docs OpenAPI. Thus the requested npm run typecheck, npm run lint, npm run test and npm run build were all executed successfully.
  • Native-value/RHF cases cover number/string/empty distinctions, disabled controls/options, dynamic and unlisted edit values. Actual modal cases cover named options, protocol-dependent fields, create and edit serialization, transport defaults, edit-mode disabling, named Security, hidden-tab validation descriptions/focus and blocked invalid submission.
  • node tools/check-inbound-keyboard.mjs against built Storybook: 4/4 PASS, desktop + mobile viewport, create + edit. Uses trusted Chromium Tab/Arrow/Enter/typeahead, checks None/TLS/REALITY keyboard selection, desktop native-picker cancellation, native selected value in the accessibility tree, modal focus containment/return, actual serialized add/update requests and edit-client preservation. Only HTTP responses are stubbed; the form, selectors, validation and adapters are real.
  • The exact added CI preview/readiness/keyboard command also passed locally. Actionlint (-shellcheck=), final frontend lint/format checks and git diff --check passed.
  • Initial full-suite failures were obsolete Ant Design DOM selectors in existing test helpers; those helpers now drive the actual native options and retain their original business assertions. No snapshots were regenerated to make failures pass.

Remaining manual verification

No actual TalkBack or NVDA session was available. Mobile viewport emulation is not Android, and Chromium AX/keyboard tests cannot certify assistive-technology speech or touch exploration. Please validate with the reporter on Android TalkBack/Chrome and desktop NVDA before closing #7023.

The concise manual checklist and repeat commands cover touch exploration, selected-value announcements, native picker cancellation, Protocol/Transport/security-dependent fields, complex search/multi-select/tags, validation correction, Save/Close and opener focus. Complex lists render all options inside this modal, which trades additional DOM work for actual option semantics; their search/multi-select behavior is retained.

Upstream CI completed successfully on the published head; details below. This PR intentionally references, rather than automatically closes, the issue.

Final upstream CI

All 11 main checks passed on 823f149cc724ff048730d2cec8d0ab48cc4bbcfb in CI run 40894130269: frontend, go-test, codegen, golangci, PostgreSQL durable-first, PostgreSQL migration, race, node-e2e, govulncheck, fuzz-smoke and shell-lint. The frontend job's new Inbound keyboard and accessibility tree step also completed successfully, alongside its test and production/Storybook build steps.

The optional Claude workflow reported that its account quota was already spent and no code on this head was examined. Its successful workflow status is not a code-review approval. Actual TalkBack/NVDA verification remains the manual follow-up described above.


🔄 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/7025 **Author:** [@HamedSanaei](https://github.com/HamedSanaei) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 11/5/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `codex/issue-7023-inbound-a11y` --- ### 📝 Commits (4) - [`823f149`](https://github.com/MHSanaei/3x-ui/commit/823f149cc724ff048730d2cec8d0ab48cc4bbcfb) fix(frontend): make inbound pickers screen-reader accessible - [`290aeb1`](https://github.com/MHSanaei/3x-ui/commit/290aeb1b2d7791e44d0a918ad2debbfb82b3f4f6) chore: integrate current main for PR 7025 validation - [`756134c`](https://github.com/MHSanaei/3x-ui/commit/756134cb78a190972284082456e121f2148f3eab) Merge remote-tracking branch 'origin/main' into codex/review-pr-7025-20261105 - [`f647d84`](https://github.com/MHSanaei/3x-ui/commit/f647d844cc5517dc6bf6d9752657c4cbfe3d02aa) Merge remote-tracking branch 'origin/main' into codex/review-pr-7025-20261105 ### 📊 Changes **29 files changed** (+875 additions, -110 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+9 -0) 📝 `frontend/README.md` (+27 -0) ➕ `frontend/src/components/form/NativeSelect.css` (+14 -0) ➕ `frontend/src/components/form/NativeSelect.stories.tsx` (+67 -0) ➕ `frontend/src/components/form/NativeSelect.tsx` (+70 -0) 📝 `frontend/src/components/form/rhf/FormField.stories.tsx` (+3 -0) 📝 `frontend/src/components/form/rhf/FormField.tsx` (+12 -9) 📝 `frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx` (+2 -1) 📝 `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx` (+9 -8) 📝 `frontend/src/lib/xray/forms/transport/XDriveForm.tsx` (+2 -1) ➕ `frontend/src/pages/inbounds/form/InboundFormModal.stories.tsx` (+121 -0) 📝 `frontend/src/pages/inbounds/form/InboundFormModal.tsx` (+52 -8) 📝 `frontend/src/pages/inbounds/form/protocols/hysteria.tsx` (+3 -2) 📝 `frontend/src/pages/inbounds/form/protocols/mixed.tsx` (+3 -2) 📝 `frontend/src/pages/inbounds/form/protocols/shadowsocks.tsx` (+6 -3) 📝 `frontend/src/pages/inbounds/form/protocols/tuic.tsx` (+4 -3) 📝 `frontend/src/pages/inbounds/form/protocols/tunnel.tsx` (+3 -2) 📝 `frontend/src/pages/inbounds/form/protocols/vless.tsx` (+3 -2) 📝 `frontend/src/pages/inbounds/form/security/reality.tsx` (+4 -1) 📝 `frontend/src/pages/inbounds/form/security/tls.tsx` (+6 -5) _...and 9 more files_ </details> ### 📄 Description Refs #7023 Make the Create/Edit Inbound pickers expose actual selectable options and selected values, preserve their form behavior, and keep keyboard focus in the modal. Related reports: #6832 and #6107. The label/tooltip/localization work from #6907 is preserved. ## Root cause and solution Inspection of the installed Ant Design 6.6.7/rc-select implementation and rendered Chromium accessibility tree confirmed several separate gaps: - Default virtualization puts option semantics on a hidden three-item proxy. The visible rows users explore have no option role. With `virtual={false}`, rc-select does expose the actual list and selectable options, but its closed single-select combobox still has an empty value in Chromium's AX tree. It therefore does not fully solve the simple-picker problem. - Default popups are mounted outside the aria-modal dialog. Retained searchable/multi-select controls now render real options **inside the inbound modal body**, through a scoped ConfigProvider. The modal shell itself ignores pointer events, so the popup is deliberately placed in its interactive body. - Security's radio group had no accessible group name. RHF validation help was visible but not associated with the input. - Real Tab navigation could leave the document after the last modal button. The inbound modal now wraps Tab/Shift+Tab only at its first/last button boundaries, while retaining Ant Design's normal focus/close behavior and leaving popup focus alone. Use a small, themed native `<select>` for the short single-value lists: Protocol, Transport, address strategy, reset schedule, encryption/auth type, and similar protocol/TLS/REALITY/transport fields. The browser owns their roles, selected-value semantics, keyboard interaction and mobile picker. No internal Select ARIA roles or active-descendant state are overridden. `NativeSelect` forwards IDs, ARIA descriptions, blur and React 19 refs. Its private option keys map back to the original typed values, including numeric zero, strings and empty strings; disabled options/fields, dynamic lists and unlisted saved values are preserved. Existing onChange/onAfterChange handlers still receive the same values. It also supports the existing small preset control and Ant Design theme tokens. Searchable, clearable, tag, autocomplete and multi-select controls remain Ant Design controls. There is no application-wide change to Ant Design defaults. The fixed-choice controls in the shared FinalMask, CustomSockopt and XDrive editors use the same native primitive because these editors are part of the inbound workflow; their outbound consumers are covered by the full regression suite. ## Modified components/files - `frontend/src/components/form/NativeSelect.{tsx,css,stories.tsx}`: native single selection and typed-value browser example. - `frontend/src/components/form/rhf/FormField.{tsx,stories.tsx}`: merge existing descriptions, tooltip, extra guidance and translated validation help; expose invalid state without replacing a caller's ARIA props. - `frontend/src/pages/inbounds/form/InboundFormModal.{tsx,stories.tsx}`: basic/transport pickers, scoped complex-control options, named Security group, keyboard boundaries and real add/edit fixtures. - Inbound protocol fields: `hysteria.tsx`, `mixed.tsx`, `shadowsocks.tsx`, `tuic.tsx`, `tunnel.tsx`, `vless.tsx`. - Inbound security fields: `security/reality.tsx`, `security/tls.tsx`; transport fields: `transport/sockopt.tsx`, `transport/xhttp.tsx`. - Shared editors: `frontend/src/lib/xray/forms/transport/{CustomSockoptList,FinalMaskForm,XDriveForm}.tsx`. - Regression tests: `native-select.test.tsx`, `inbound-form-accessibility.test.tsx`, `rhf-form-field.test.tsx`; adapt the existing inbound/outbound tests and `test-utils.tsx` to operate real native options instead of requiring Ant Design CSS markup. Remove the old crash-only inbound assertion and strengthen the existing protocol-shape assertion. - `frontend/tools/check-inbound-keyboard.mjs`, the frontend CI job, and `frontend/README.md`: repeatable trusted-keyboard/AX/request checks and the real-screen-reader verification checklist. ## Behavior preserved Protocol availability and option values, edit-mode protocol disabling, localization, defaults/conditional fields, transport resets and security side effects are unchanged. Existing schema validation and form-to-wire adapters are untouched. Edit payloads still omit server-owned clients. No Go, API contract, database, quota/expiry/client setting or Xray configuration generation changes; no new dependency or translation key. ## Automated verification - Test first: the real modal initially failed option/list ownership and named Security checks; RHF validation had no accessible description. A separate reproduction then showed the selected protocol's closed value was empty even with non-virtual Ant Design options. These were recorded red before their fixes. - `make verify`: **PASS**, including code generation freshness, Go lint/tests/build, frontend lint/format/typecheck, **2,030 tests across 219 files**, production Vite build, Storybook build and matching docs OpenAPI. Thus the requested `npm run typecheck`, `npm run lint`, `npm run test` and `npm run build` were all executed successfully. - Native-value/RHF cases cover number/string/empty distinctions, disabled controls/options, dynamic and unlisted edit values. Actual modal cases cover named options, protocol-dependent fields, create and edit serialization, transport defaults, edit-mode disabling, named Security, hidden-tab validation descriptions/focus and blocked invalid submission. - `node tools/check-inbound-keyboard.mjs` against built Storybook: **4/4 PASS**, desktop + mobile viewport, create + edit. Uses trusted Chromium Tab/Arrow/Enter/typeahead, checks None/TLS/REALITY keyboard selection, desktop native-picker cancellation, native selected value in the accessibility tree, modal focus containment/return, actual serialized add/update requests and edit-client preservation. Only HTTP responses are stubbed; the form, selectors, validation and adapters are real. - The exact added CI preview/readiness/keyboard command also passed locally. Actionlint (`-shellcheck=`), final frontend lint/format checks and `git diff --check` passed. - Initial full-suite failures were obsolete Ant Design DOM selectors in existing test helpers; those helpers now drive the actual native options and retain their original business assertions. No snapshots were regenerated to make failures pass. ## Remaining manual verification **No actual TalkBack or NVDA session was available.** Mobile viewport emulation is not Android, and Chromium AX/keyboard tests cannot certify assistive-technology speech or touch exploration. Please validate with the reporter on Android TalkBack/Chrome and desktop NVDA before closing #7023. The concise [manual checklist and repeat commands](https://github.com/HamedSanaei/3x-ui/blob/codex/issue-7023-inbound-a11y/frontend/README.md#inbound-accessibility-verification) cover touch exploration, selected-value announcements, native picker cancellation, Protocol/Transport/security-dependent fields, complex search/multi-select/tags, validation correction, Save/Close and opener focus. Complex lists render all options inside this modal, which trades additional DOM work for actual option semantics; their search/multi-select behavior is retained. Upstream CI completed successfully on the published head; details below. This PR intentionally references, rather than automatically closes, the issue. ## Final upstream CI All **11 main checks passed** on `823f149cc724ff048730d2cec8d0ab48cc4bbcfb` in [CI run 40894130269](https://github.com/MHSanaei/3x-ui/actions/runs/40894130269): frontend, go-test, codegen, golangci, PostgreSQL durable-first, PostgreSQL migration, race, node-e2e, govulncheck, fuzz-smoke and shell-lint. The frontend job's new **Inbound keyboard and accessibility tree** step also completed successfully, alongside its test and production/Storybook build steps. The optional Claude workflow reported that its account quota was already spent and no code on this head was examined. Its successful workflow status is not a code-review approval. Actual TalkBack/NVDA verification remains the manual follow-up described above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #7025] fix(frontend): improve inbound form accessibility for screen readers to [PR #7025] [MERGED] fix(frontend): improve inbound form accessibility for screen readers 2026-11-07 14:34:06 +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#6585
No description provided.