mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-17 18:45:03 +03:00
fix(frontend): make the panel usable with screen readers (#6907)
* fix(frontend): make the panel usable with screen readers * fix(frontend): keep mobile tab names and the inbound expiry hint Review of #6907 found two gaps in the screen-reader pass: - On phone-width screens catTabLabel renders only the icon and names the tab by putting aria-label on it, but callers now pass that icon with aria-hidden for the desktop label, so every Settings, Xray and Host category tab lost its name under TalkBack. catTabLabel now clears aria-hidden on the icon it uses as the name. - DateTimePicker forwarded id and aria-label but not aria-describedby, so the inbound expiry hint ("leave blank to never expire") was never attached. It now forwards it on both the Gregorian and Jalali input.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useId } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
AutoComplete,
|
||||
@@ -21,6 +21,7 @@ import { HttpUtil } from '@/utils';
|
||||
|
||||
export default function TuicFields() {
|
||||
const { t } = useTranslation();
|
||||
const uid = useId();
|
||||
const [messageApi, messageContextHolder] = message.useMessage();
|
||||
const { control, setValue } = useFormContext();
|
||||
const [loadingPanelCert, setLoadingPanelCert] = useState(false);
|
||||
@@ -147,8 +148,9 @@ export default function TuicFields() {
|
||||
return (
|
||||
<>
|
||||
{messageContextHolder}
|
||||
<Form.Item label={t('pages.inbounds.publicKey')}>
|
||||
<Form.Item htmlFor={`${uid}-certificate`} label={t('pages.inbounds.publicKey')}>
|
||||
<AutoComplete
|
||||
id={`${uid}-certificate`}
|
||||
value={certificate}
|
||||
options={certOptions}
|
||||
onChange={(v) => setValue('settings.server.certificate', v)}
|
||||
@@ -156,8 +158,9 @@ export default function TuicFields() {
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t('pages.inbounds.privatekey')}>
|
||||
<Form.Item htmlFor={`${uid}-privateKey`} label={t('pages.inbounds.privatekey')}>
|
||||
<AutoComplete
|
||||
id={`${uid}-privateKey`}
|
||||
value={privateKey}
|
||||
options={keyOptions}
|
||||
onChange={(v) => setValue('settings.server.private_key', v)}
|
||||
@@ -169,13 +172,13 @@ export default function TuicFields() {
|
||||
<Space wrap style={{ display: 'flex', flexWrap: 'wrap', width: '100%' }}>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<CloudDownloadOutlined />}
|
||||
icon={<CloudDownloadOutlined aria-hidden />}
|
||||
loading={loadingPanelCert}
|
||||
onClick={setCertFromPanel}
|
||||
>
|
||||
{t('pages.inbounds.setDefaultCert')}
|
||||
</Button>
|
||||
<Button icon={<SyncOutlined />} onClick={autofillFromSni}>
|
||||
<Button icon={<SyncOutlined aria-hidden />} onClick={autofillFromSni}>
|
||||
{t('pages.inbounds.form.autoFill')}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -217,12 +220,21 @@ export default function TuicFields() {
|
||||
|
||||
<Divider titlePlacement="start">{t('pages.xray.tuic.profileOptions')}</Divider>
|
||||
|
||||
<Form.Item label={t('pages.xray.tuic.sni')} tooltip={t('pages.xray.tuic.sniHint')}>
|
||||
<Form.Item
|
||||
htmlFor={`${uid}-sni`}
|
||||
label={t('pages.xray.tuic.sni')}
|
||||
tooltip={t('pages.xray.tuic.sniHint')}
|
||||
>
|
||||
<Input
|
||||
id={`${uid}-sni`}
|
||||
aria-describedby={`${uid}-sni-hint`}
|
||||
value={sni}
|
||||
placeholder="example.com"
|
||||
onChange={(e) => handleSniChange(e.target.value)}
|
||||
/>
|
||||
<span id={`${uid}-sni-hint`} hidden>
|
||||
{t('pages.xray.tuic.sniHint')}
|
||||
</span>
|
||||
</Form.Item>
|
||||
|
||||
<FormField
|
||||
|
||||
Reference in New Issue
Block a user