Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiIconTip] Ensure aria-hidden attribute is suppressed to avoid axe (accessibility) errors in loading cycle #7400

Closed
1Copenut opened this issue Dec 6, 2023 · 2 comments · Fixed by #7606

Comments

@1Copenut
Copy link
Contributor

1Copenut commented Dec 6, 2023

Is your feature request related to a problem? Please describe.
Our icon_tip.tsx file adds a tabindex=0 to the child EuiIcon on line 66. This is causing an accessibility violation in Kibana just now because icons with aria-hidden="true" have a tabindex that allows them to be reached by keyboard focus before the finished icon has been loaded.

Describe the solution you'd like
I'd like to find a way to signal to EuiIconTip that it should not be ARIA hidden by its nature. Maybe we could explicitly set the attribute undefined ?

<EuiToolTip position={position} delay={delay} {...rest}>
  <EuiIcon
+   aria-hidden={undefined}
    tabIndex={0}
    type={type}
    color={color}
    size={size}
    aria-label={ariaLabel}
    {...iconProps}
  />
</EuiToolTip>

Additional context
Kibana is tracking this error in elastic/kibana#172598. There may be others that haven't been discovered yet.

The Buildkite error logs showed this snippet, that suggests the scan is running while icons are not fully loaded:

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" class="euiIcon eui-alignTop css-1h8nuic-euiIcon-s-isLoading" tabindex="0" role="img" aria-label="Info" aria-hidden="true" data-is-loading="true"></svg>
Screenshot 2023-12-06 at 12 33 16 PM
@cee-chen
Copy link
Contributor

cee-chen commented Dec 7, 2023

Code to change:

// If it's an empty icon, or if there is no aria-label, aria-labelledby, or title it gets aria-hidden true

Here's my question for you Trevor - should we really be removing aria-hidden for empty/loading icons, or should we be removing the tabIndex="0"?

The latter feels more true to the intention of hiding icons that have no meaningful context attached, but the former feels more flexible for worst case scenarios, e.g.:

  1. icon is unable to finish loading, due to e.g. internet issues
  2. dev forgets to attach an aria-label but an aria-describedby does exist (thanks to the tooltip) and provides more helpful information than if it was completely hidden to SRs

@cee-chen
Copy link
Contributor

I talked through this a bit more with @peteharverson in Slack and he helped me think through the above question a bit more. The conclusion we came to was that that not applying aria-hidden to empty icons makes the most sense if a label/title of some sort is being applied - we should always prioritize providing that label to screen reader users.

@cee-chen cee-chen self-assigned this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants