You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EuiButton] Better communicate isLoading to assistive tech #4797
Loading states aren't communicated to screen readers
Fix
Include <span role="status" aria-atomic="true"> with buttons
Why role="status"? This role acts as a live region that will allow us to notify assistive tech that something changed without a user having to do anything, even if they've navigated away from the button.
Why aria-atomic="true"? This will tell the assistive tech to read the whole message instead of just the word that changed. (Because we don't know what content will be in the button, this is the safer option.)
If/When isLoading changes, pipe the new button text into the <span> we setup
If the text didn't change, make some up by appending "is loading" to the button text when isLoading=true
Clear the <span> text after 2 seconds
Even though we set aria-atomic="true" above, support is mixed so it's good practice to clear the text if you want to help ensure you're reading the whole string.
Why 2 seconds? Because there's no way to know when the assistive tech might have finished reading it so it's a good guess at "this should have finished by now..."
At the same time if loading is really a state that always needs to be communicated in a particular way. Since we already have a dedicated isLoading prop, we should just add that extra functionality in the existing buttons.
Sibling to the button, not inside (all button contents is collapsed into a simplified role that's plain text "button content" so we can't have anything inside.
Yes! (Well, doesn't have to be, but I'm assuming that's the desired setup here.)
On load, it doesn't need any text as it only needs to report when the button changes.
Basically, what's the exact setup here?
I added some DOM examples to the issue description that I hope help.
Why clear after a certain time period and not when the isLoading prop is removed / set to false?
Let's say the loading text is "Dashboards are loading" and then the default text is "Load more Dashboards".
Without removing the text, depending on the assistive tech being used, the status will say "Load more" and ignore the word "Dashboards" because it will think that the word didn't change. aria-atomic="true"should prevent that from happening but support isn't perfect.
Clearing the text behind us also leaves a cleaner DOM for assistive tech. (Assistive tech can navigate to the status message but it just repeats the button text so a user navigating through the page, if we didn't clear it, would come across the same message twice.)
Hmm, the problem right now is the current isLoading: boolean prop only has truly one unique state, true. We won't want to add this span to every EuiButton instance with isLoading = false | undefined.
Do you have suggestions about how we can get this working only for buttons relying on this isLoading prop?
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.
Activity
cchaos commentedon May 14, 2021
cchaos commentedon May 14, 2021
At the same time if
loadingis really a state that always needs to be communicated in a particular way. Since we already have a dedicatedisLoadingprop, we should just add that extra functionality in the existing buttons.myasonik commentedon May 14, 2021
Ah, I totally forgot we already support a
isLoadingprop! Updated the issue for our existing setup.[-]New **EuiButton** type: Multi-state[/-][+][EuiButton] Better communicate `isLoading` to assistive tech[/+]cchaos commentedon May 14, 2021
Some clarification questions.
<span role="status" aria-atomic="true">screenReaderOnly?Basically, what's the exact setup here?
Why clear after a certain time period and not when the
isLoadingprop is removed / set to false?myasonik commentedon May 14, 2021
I added some DOM examples to the issue description that I hope help.
Let's say the loading text is "Dashboards are loading" and then the default text is "Load more Dashboards".
Without removing the text, depending on the assistive tech being used, the status will say "Load more" and ignore the word "Dashboards" because it will think that the word didn't change.
aria-atomic="true"should prevent that from happening but support isn't perfect.Clearing the text behind us also leaves a cleaner DOM for assistive tech. (Assistive tech can navigate to the status message but it just repeats the button text so a user navigating through the page, if we didn't clear it, would come across the same message twice.)
cchaos commentedon May 14, 2021
Hmm, the problem right now is the current
isLoading: booleanprop only has truly one unique state,true. We won't want to add this span to every EuiButton instance withisLoading = false | undefined.Do you have suggestions about how we can get this working only for buttons relying on this
isLoadingprop?myasonik commentedon Aug 10, 2021
I can't think of a way to not add a
<span>to all buttons while also not introducing any new props or components...daveyholler commentedon Jan 30, 2023
Related: #5666
github-actions commentedon Sep 22, 2025
👋 Hi there - this issue hasn't had any activity in 6 months. If the EUI team has not explicitly expressed that this is something on our roadmap, it's unlikely that we'll pick this issue up. We would sincerely appreciate a PR/community contribution if this is something that matters to you! If not, and there is no further activity on this issue for another 6 months (i.e. it's stale for over a year), the issue will be auto-closed.
JasonStoltz commentedon Dec 15, 2025
Closing this old issue as it has gone stale. Feel free to re-open it if you feel it is still important.