Alerting: Fix remaining a11y issues (#43420)

* add aria labels

* reverting

* chore: revert yarn.lock

Co-authored-by: gillesdemey <gilles.de.mey@gmail.com>
This commit is contained in:
Peter Holmberg
2021-12-21 16:06:23 +01:00
committed by GitHub
parent 339cfb8736
commit 5db03cf91a
3 changed files with 12 additions and 3 deletions

View File

@@ -27,17 +27,24 @@ export const ActionIcon: FC<Props> = ({
tooltipPlacement = 'top',
...rest
}) => {
const ariaLabel = typeof tooltip === 'string' ? tooltip : undefined;
const iconEl = (
<Icon role="button" className={cx(useStyles(getStyle), className)} onClick={onClick} name={icon} {...rest} />
<Icon
role="button"
className={cx(useStyles(getStyle), className)}
onClick={onClick}
name={icon}
{...rest}
aria-label={ariaLabel}
/>
);
const ariaLabel = typeof tooltip === 'string' ? tooltip : undefined;
return (
<Tooltip content={tooltip} placement={tooltipPlacement}>
{(() => {
if (to) {
return (
<Link aria-label={ariaLabel} to={to} target={target}>
<Link to={to} target={target}>
{iconEl}
</Link>
);