Repository navigation
Description
Description
Our use of the HTML disabled attribute on buttons removes them from the accessibility tree, making them invisible to screen readers and keyboard users and preventing us from providing critical context to all users. We should use aria-disabled instead.
Problem to solve
Pervasive accessibility issue in EUI (and Kibana by extension)
Our buttons all use the HTML5 disabled attribute to remove buttons' default behavior.
As a user, seeing a button as disabled (rather than not at all) often provides critical context for users. They see it, so they know there is an option to take some action, but that action not possible right now.
For example, imagine a "Submit" button that is disabled. As a user, you'd see that button, now that you can take that "Submit" action, but it's not possible right now because there's something else you need to do first.
To further help provide that context, we often provide tooltips on those buttons that provide additional context. "This button is disabled because you need to do XYZ first.".
This is all useful context, all of which is invisible to screenreaders. They have no knowledge of the existence of that button or the additional context provided.
<EuiToolTip
position="top"
content={<p>This button is disabled because you need to do XYZ first.</p>}
>
<EuiButton disabled={true}>Submit</EuiButton>
</EuiToolTip>
Common point of friction for development teams
Teams often experience churn when they encounter this issue and find there's no current solution. Here's an example:
https://github.com/elastic/kibana-team/issues/1323
Current workarounds
One "workaround" (which is not really a feasible workaround) would be to not use disabled prop and apply all required handling manually as well as re-adding disabled styles.
Another could potentially be to add focusable wrappers with e.g. tooltips instead.
Examples in Kibana
Recent requests or related issues or discussions:
- [EuiFilterButton] Add isClearable prop #8955
- [EuiSelectable] Enable focusable disabled options #8869
- [EuiButton] Better communicate
isLoadingto assistive tech #4797
Slack threads
- https://elastic.slack.com/archives/C7QC1JV6F/p1749071324516399
- https://elastic.slack.com/archives/C7QC1JV6F/p1749562984990239
- https://elastic.slack.com/archives/C7QC1JV6F/p1728313799137969
- https://elastic.slack.com/archives/C7QC1JV6F/p1726497255260529
- https://elastic.slack.com/archives/C7CSV2REU/p1714131301706329
Proposed solution
To improve this behavior we want to replace the usage of the disabled attribute on button DOM elements with aria-disabled. This means:
- the element is still announced in a disabled state to assistive technologies
- the default behavior of
disableddoes not apply = the element has still all default events and behaviors
Because the default disabled behavior is removed, we'll need to manually ensure the element behaves as if it was disabled. This means:
- ensuring no unwanted events are triggered (e.g. unsetting of mouse and key events)
- ensuring the disabled styling is applied based on the prop
disablednot the DOM attribute via the selector:disabled - adjust all test cases that check disabled states
Considerations
-
Based on the amount of different components that would benefit from this update (within EUI as well as on consumer side) we should consider providing a sharable solution (e.g. a hook) to provide the "set-as-disabled" functionality.
-
Updating a basic attribute like
disabledmight result in a lot of broken tests depending on testing framework and how those handle the check for "isDisabled". It would be wise to run tests/CI early with an early PoC to gage the impact and potential issues early on.- ⚠ Testing-library's
toBeDisableddoes not includearia-disabled(issue) - ⚠ Selenium uses
isEnabledto check for disabled elements (docs) which only checks for thedisabledattribute (code) - ⚠ Cypress checks disability based only for the
disabledattribute (docs) - 💭 We might want to consider providing new testing helpers and/or a combined one that checks
disabledandaria-disabledtogether
- ⚠ Testing-library's
Components that use <button> elements with disabled attribute
ℹ This list includes exported components as well as internal ones that are subcomponents of exported components.
- EuiButton
- EuiButtonEmpty
- EuiButtonIcon
- EuiBadge
- EuiCard
- EuiContextMenuItem
- EuiColorPickerSwatch
- EuiSuperDatePicker
- EuiDatePopoverButton
- EuiFilterSelectItem
- EuiFormControlLayoutClearButton
- EuiFormControlLayoutCustomIcon
- EuiRangeThumb
- EuiTickValue
- EuiSuperSelectControl
- EuiSwitch
- EuiImageButton
- EuiLink
- EuiListGroupItem
- EuiPanel
- EuiResizableButton
- EuiSelectableListItem
- EuiSideNavItem
- EuiStepHorizontal
- EuiTab
- EuiTreeViewItem
Some relevant research
WCAG guidance
Historical context
@miukimiu brought up a great question in #5649 with her comment about the isLoading behavior:
To introduce a EuiButtonIcon
isLoadingstate I can follow the other buttons isLoading state approach:
- The button gets
disabled.- The EuiIcon gets replaced with a EuiLoadingSpinner.
- We introduce a new size to EuiLoadingSpinner
"XXL"so that all the sizes match the EuiIcon sizes.But I have some a11y questions.
- When the button gets
disabledthe focus state is missed.- It gets removed from the accessibility tree and is invisible to assistive technology users
So when the EuiButtonIcon
isLoadingwould adding anaria-disabledinstead ofdisabledbe more appropriate? Or is it OK to keep following the other buttons' pattern?
Activity
chandlerprall commentedon Mar 2, 2022
👍 If we decide to implement
aria-disabledinstead ofdisabledin some cases, we'll need to preventonClickand possibly other events from firing.elizabetdev commentedon Mar 3, 2022
The following article is also interesting to add to @1Copenut's relevant research list: Making Disabled Buttons More Inclusive.
[-][EuiButton] Review the `isLoading` prop behavior for screen reader experience[/-][+][EuiButton] Review the `isLoading` and `isDisabled` prop behavior for screen reader experience[/+]github-actions commentedon Oct 5, 2022
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
1Copenut commentedon Oct 25, 2022
Another discussion of this point, on Material UI: mui/material-ui#14455
cee-chen commentedon Jan 30, 2023
#4797 Should be handled at the same time
github-actions commentedon Oct 22, 2023
👋 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.
26 remaining items
JasonStoltz commentedon Sep 11, 2025
Just noted that this issue came up again, today in Slack.
User: "possible to display tooltip on basic table icon actions?"
Us: "It's possible with the description property on DefaultItemAction. The tooltip is rendered when enabled = true . Let me know if that's what you need.
User: "but what we do if we want to show tooltip to tell why button is disabled?
Us: "his is a long standing topic and a frequent question we get. From accessiblity point of view, it's not possible to display a tooltip on a disabled button because disabled buttons are not focusable. We have this issue on this quarter roadmap which you can track: #5666. We know it's pain right now"
User: "Yeah but we have a tooltip wrapped disabled buttons everywhere in kibana"
mgadewoll commentedon Oct 2, 2025
ℹ️ Another related issue:
The usage of
isLoadingadds thedisabledattribute which results in removed focus and prevents theblurevent from being fired. This leads to the tooltip being stuck on the button as the state wasn't triggered on blur.[Obs AI Assistant] Update tooltip behaviour to close on mouse out (#2…
[Obs AI Assistant] Update tooltip behaviour to close on mouse out (el…
[Obs AI Assistant] Update tooltip behaviour to close on mouse out (el…
[9.2] [Obs AI Assistant] Update tooltip behaviour to close on mouse o…
[Obs AI Assistant] Update tooltip behaviour to close on mouse out (el…
[9.1] [Obs AI Assistant] Update tooltip behaviour to close on mouse o…
[8.19] [Obs AI Assistant] Update tooltip behaviour to close on mouse …
isLoadingto assistive tech #4797JasonStoltz commentedon Dec 15, 2025
@mgadewoll Closing this as we delivered #9201 in https://github.com/elastic/eui/releases/tag/v109.1.0 and I don't believe we're planning to do any more here for the time being.
Feel free to re-open if we still need this issue.
mgadewoll commentedon Dec 16, 2025
@JasonStoltz Thanks. That's fine. We might want to get back to #8869 eventually. But it makes sense to give the disabled button functionality some time to be tested and used while in Beta state first.