✨(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:
@@ -15,6 +15,7 @@ and this project adheres to
|
|||||||
- ♿ improve accessibility by adding landmark roles to layout #1394
|
- ♿ improve accessibility by adding landmark roles to layout #1394
|
||||||
- ♿ add document visible in list and openable via enter key #1365
|
- ♿ add document visible in list and openable via enter key #1365
|
||||||
- ♿ add pdf outline property to enable bookmarks display #1368
|
- ♿ add pdf outline property to enable bookmarks display #1368
|
||||||
|
- ♿ hide decorative icons from assistive tech with aria-hidden #1404
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -63,5 +63,5 @@ export const clickOnAddRootSubPage = async (page: Page) => {
|
|||||||
const rootItem = page.getByTestId('doc-tree-root-item');
|
const rootItem = page.getByTestId('doc-tree-root-item');
|
||||||
await expect(rootItem).toBeVisible();
|
await expect(rootItem).toBeVisible();
|
||||||
await rootItem.hover();
|
await rootItem.hover();
|
||||||
await rootItem.getByRole('button', { name: 'add_box' }).click();
|
await rootItem.getByRole('button', { name: /add subpage/i }).click();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ export const Icon = ({
|
|||||||
variant = 'outlined',
|
variant = 'outlined',
|
||||||
...textProps
|
...textProps
|
||||||
}: IconProps) => {
|
}: IconProps) => {
|
||||||
|
const hasLabel = 'aria-label' in textProps || 'aria-labelledby' in textProps;
|
||||||
|
const ariaHidden =
|
||||||
|
'aria-hidden' in textProps ? textProps['aria-hidden'] : !hasLabel;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
{...textProps}
|
{...textProps}
|
||||||
|
aria-hidden={ariaHidden}
|
||||||
className={clsx('--docs--icon-bg', textProps.className, {
|
className={clsx('--docs--icon-bg', textProps.className, {
|
||||||
'material-icons-filled': variant === 'filled',
|
'material-icons-filled': variant === 'filled',
|
||||||
'material-icons': variant === 'outlined',
|
'material-icons': variant === 'outlined',
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ export const DocTreeItemActions = ({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
|
aria-label={t('Add subpage')}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
variant="filled"
|
variant="filled"
|
||||||
|
|||||||
Reference in New Issue
Block a user