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:
Alireza Ahmadi
2026-10-23 18:29:47 +02:00
committed by GitHub
parent 775b2b0b26
commit e2184777a0
156 changed files with 2373 additions and 863 deletions
+41 -31
View File
@@ -113,7 +113,7 @@ function UngroupIcon() {
height: '1em',
}}
>
<TagsOutlined />
<TagsOutlined aria-hidden />
<span
aria-hidden="true"
style={{
@@ -1081,6 +1081,7 @@ export default function ClientsPage() {
checked={!!record.enable}
size="small"
loading={togglingEmail === record.email}
aria-label={t('pages.clients.enabled')}
onChange={(next) => onToggleEnable(record, next)}
/>
),
@@ -1140,16 +1141,20 @@ export default function ClientsPage() {
render: (_v, record) => {
if (!record.group) return <Typography.Text type="secondary">—</Typography.Text>;
const isActive = filters.groups.includes(record.group);
const filterByGroup = () => {
if (!isActive) setFilters({ ...filters, groups: [...filters.groups, record.group!] });
};
return (
<Tag
color="geekblue"
style={{ margin: 0, cursor: 'pointer', opacity: isActive ? 0.6 : 1 }}
role="button"
tabIndex={0}
onClick={(e) => {
e.stopPropagation();
if (!isActive) {
setFilters({ ...filters, groups: [...filters.groups, record.group!] });
}
filterByGroup();
}}
onKeyDown={activateOnKey(filterByGroup)}
>
{record.group}
</Tag>
@@ -1327,7 +1332,7 @@ export default function ClientsPage() {
<SummaryStat
title={t('clients')}
value={summary.total}
prefix={<TeamOutlined />}
prefix={<TeamOutlined aria-hidden />}
onSelect={() => selectBucket(null)}
/>
</Col>
@@ -1393,7 +1398,7 @@ export default function ClientsPage() {
{selectedRowKeys.length === 0 ? (
<Button
type="primary"
icon={<PlusOutlined />}
icon={<PlusOutlined aria-hidden />}
onClick={onAdd}
aria-label={t('pages.clients.addClients')}
>
@@ -1418,20 +1423,20 @@ export default function ClientsPage() {
? [
{
key: 'attach',
icon: <UsergroupAddOutlined />,
icon: <UsergroupAddOutlined aria-hidden />,
label: t('pages.clients.attach'),
onClick: () => setBulkAttachOpen(true),
},
{
key: 'detach',
icon: <UsergroupDeleteOutlined />,
icon: <UsergroupDeleteOutlined aria-hidden />,
label: t('pages.clients.detach'),
danger: true,
onClick: () => setBulkDetachOpen(true),
},
{
key: 'addToGroup',
icon: <TagsOutlined />,
icon: <TagsOutlined aria-hidden />,
label: t('pages.clients.addToGroup'),
onClick: () => setBulkGroupOpen(true),
},
@@ -1445,26 +1450,26 @@ export default function ClientsPage() {
{ type: 'divider' as const },
{
key: 'enable',
icon: <CheckCircleOutlined />,
icon: <CheckCircleOutlined aria-hidden />,
label: t('pages.clients.enable'),
onClick: () => onBulkSetEnable(true),
},
{
key: 'disable',
icon: <StopOutlined />,
icon: <StopOutlined aria-hidden />,
label: t('pages.clients.disable'),
danger: true,
onClick: () => onBulkSetEnable(false),
},
{
key: 'adjust',
icon: <ClockCircleOutlined />,
icon: <ClockCircleOutlined aria-hidden />,
label: t('pages.clients.adjust'),
onClick: () => setBulkAdjustOpen(true),
},
{
key: 'subLinks',
icon: <LinkOutlined />,
icon: <LinkOutlined aria-hidden />,
label: t('pages.clients.subLinks'),
onClick: () => setSubLinksOpen(true),
},
@@ -1472,39 +1477,39 @@ export default function ClientsPage() {
: [
{
key: 'bulk',
icon: <UsergroupAddOutlined />,
icon: <UsergroupAddOutlined aria-hidden />,
label: t('pages.clients.bulk'),
onClick: () => setBulkAddOpen(true),
},
{
key: 'export',
icon: <DownloadOutlined />,
icon: <DownloadOutlined aria-hidden />,
label: t('pages.clients.exportClients'),
onClick: onExportClients,
},
{
key: 'import',
icon: <UploadOutlined />,
icon: <UploadOutlined aria-hidden />,
label: t('pages.clients.importClients'),
onClick: onImportClients,
},
{
key: 'resetAll',
icon: <RetweetOutlined />,
icon: <RetweetOutlined aria-hidden />,
label: t('pages.clients.resetAllTraffics'),
onClick: onResetAllTraffics,
},
{ type: 'divider' as const },
{
key: 'delDepleted',
icon: <RestOutlined />,
icon: <RestOutlined aria-hidden />,
label: t('pages.clients.delDepleted'),
danger: true,
onClick: onDelDepleted,
},
{
key: 'delOrphans',
icon: <DisconnectOutlined />,
icon: <DisconnectOutlined aria-hidden />,
label: t('pages.clients.delOrphans'),
danger: true,
onClick: onDeleteOrphans,
@@ -1512,14 +1517,14 @@ export default function ClientsPage() {
],
}}
>
<Button icon={<MoreOutlined />} aria-label={t('more')}>
<Button icon={<MoreOutlined aria-hidden />} aria-label={t('more')}>
{!isMobile && t('more')}
</Button>
</Dropdown>
{selectedRowKeys.length > 0 && (
<Button
danger
icon={<DeleteOutlined />}
icon={<DeleteOutlined aria-hidden />}
onClick={onBulkDelete}
style={{ marginInlineStart: 'auto' }}
aria-label={t('delete')}
@@ -1536,14 +1541,14 @@ export default function ClientsPage() {
onChange={(e) => setSearchKey(e.target.value)}
placeholder={t('pages.clients.searchPlaceholder')}
allowClear
prefix={<SearchOutlined />}
prefix={<SearchOutlined aria-hidden />}
size={isMobile ? 'small' : 'middle'}
style={{ maxWidth: 320 }}
aria-label={t('search')}
/>
<Badge count={activeCount} size="small" offset={[-4, 4]}>
<Button
icon={<FilterOutlined />}
icon={<FilterOutlined aria-hidden />}
size={isMobile ? 'small' : 'middle'}
onClick={() => setFilterDrawerOpen(true)}
type={activeCount > 0 ? 'primary' : 'default'}
@@ -1556,7 +1561,7 @@ export default function ClientsPage() {
value={sortValueFor(sortColumn, sortOrder)}
aria-label={t('sort')}
size={isMobile ? 'small' : 'middle'}
suffix={<SortAscendingOutlined />}
suffix={<SortAscendingOutlined aria-hidden />}
style={{ minWidth: isMobile ? 130 : 200 }}
onChange={(value) => {
const opt = SORT_OPTIONS.find((o) => o.value === value);
@@ -1709,7 +1714,10 @@ export default function ClientsPage() {
locale={{
emptyText: (
<div className="clients-empty">
<TeamOutlined style={{ fontSize: 32, marginBottom: 8 }} />
<TeamOutlined
aria-hidden
style={{ fontSize: 32, marginBottom: 8 }}
/>
<div>{t('noData')}</div>
</div>
),
@@ -1734,7 +1742,7 @@ export default function ClientsPage() {
)}
{filteredClients.length === 0 && (
<div className="card-empty">
<TeamOutlined style={{ fontSize: 28, opacity: 0.5 }} />
<TeamOutlined aria-hidden style={{ fontSize: 28, opacity: 0.5 }} />
<div>{t('noData')}</div>
</div>
)}
@@ -1799,6 +1807,7 @@ export default function ClientsPage() {
checked={!!row.enable}
size="small"
loading={togglingEmail === row.email}
aria-label={t('pages.clients.enabled')}
onChange={(next) => onToggleEnable(row, next)}
/>
<Dropdown
@@ -1810,7 +1819,8 @@ export default function ClientsPage() {
key: 'qr',
label: (
<>
<QrcodeOutlined /> {t('pages.clients.qrCode')}
<QrcodeOutlined aria-hidden />{' '}
{t('pages.clients.qrCode')}
</>
),
onClick: () => onShowQr(row.email),
@@ -1819,7 +1829,7 @@ export default function ClientsPage() {
key: 'reset',
label: (
<>
<RetweetOutlined />{' '}
<RetweetOutlined aria-hidden />{' '}
{t('pages.inbounds.resetTraffic')}
</>
),
@@ -1829,7 +1839,7 @@ export default function ClientsPage() {
key: 'edit',
label: (
<>
<EditOutlined /> {t('edit')}
<EditOutlined aria-hidden /> {t('edit')}
</>
),
onClick: () => onEdit(row.email),
@@ -1839,7 +1849,7 @@ export default function ClientsPage() {
danger: true,
label: (
<>
<DeleteOutlined /> {t('delete')}
<DeleteOutlined aria-hidden /> {t('delete')}
</>
),
onClick: () => onDelete(row.email),
@@ -1851,7 +1861,7 @@ export default function ClientsPage() {
type="text"
size="small"
className="row-action-trigger"
icon={<MoreOutlined />}
icon={<MoreOutlined aria-hidden />}
aria-label={t('more')}
/>
</Dropdown>