(frontend) hide decorative icons from assistive tech with aria-hidden

improves accessibility by reducing screen reader noise from icon elements

Signed-off-by: Cyril <c.gromoff@gmail.com>
This commit is contained in:
Cyril
2025-09-18 08:22:01 +02:00
parent 0894bcdca5
commit e5e5fba0b3
4 changed files with 8 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ and this project adheres to
- ♿ improve accessibility by adding landmark roles to layout #1394
- ♿ add document visible in list and openable via enter key #1365
- ♿ add pdf outline property to enable bookmarks display #1368
- ♿ hide decorative icons from assistive tech with aria-hidden #1404
### Fixed

View File

@@ -63,5 +63,5 @@ export const clickOnAddRootSubPage = async (page: Page) => {
const rootItem = page.getByTestId('doc-tree-root-item');
await expect(rootItem).toBeVisible();
await rootItem.hover();
await rootItem.getByRole('button', { name: 'add_box' }).click();
await rootItem.getByRole('button', { name: /add subpage/i }).click();
};

View File

@@ -12,9 +12,14 @@ export const Icon = ({
variant = 'outlined',
...textProps
}: IconProps) => {
const hasLabel = 'aria-label' in textProps || 'aria-labelledby' in textProps;
const ariaHidden =
'aria-hidden' in textProps ? textProps['aria-hidden'] : !hasLabel;
return (
<Text
{...textProps}
aria-hidden={ariaHidden}
className={clsx('--docs--icon-bg', textProps.className, {
'material-icons-filled': variant === 'filled',
'material-icons': variant === 'outlined',

View File

@@ -181,6 +181,7 @@ export const DocTreeItemActions = ({
});
}}
color="primary"
aria-label={t('Add subpage')}
>
<Icon
variant="filled"