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
* chore: accessible disabled button
* chore: adds new pending state tests
* chore: update button disabled selector in styles
* chore: update button disabled selector in styles
* chore: updates guidelines with more info on disabled
* chore: updates split-button and fab with a11y fix for disabled
* chore: update select a11y test results
* chore: updates dismiss class functionality
* chore: linting
* chore: moves click handlers to component class
* Update metadata
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: libs/components/src/lib/button/ACCESSIBILITY.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,13 @@
10
10
- Always provide an `aria-label` for buttons that contain only an icon.
11
11
- The label is announced by screen readers and communicates the button’s purpose.
12
12
13
+
### Disabled Buttons
14
+
15
+
When you set the `disabled` attribute on the Button component, the `aria-disabled` attribute on the button element. This allows the button to receive focus so that it can be announced (as a disabled button) by a screen reader.
16
+
13
17
## Best Practices
14
18
15
-
### Avoid Disabling Buttons
19
+
### Never Put Tooltips/Toggletips on Disabled Buttons
16
20
17
21
- Disabled buttons cannot receive focus and don’t explain why they can’t be used.
18
22
- Instead, consider keeping the button active and use validation or error messages to guide the user.
Try to use [progressive disclosure](https://www.nngroup.com/articles/progressive-disclosure/) instead of disabled buttons.
641
+
1. **Cause deception**<br />The call to action text draws users to click, but nothing happens. This causes confusion, leading users to think that the interface is broken.
642
+
2. **Insufficient contrast**<br />Even if the button is disabled, the button label is still crucial for understanding the interface.
643
+
3. **No feedback**<br />Without feedback, users don't know what has gone wrong or how to fix the error.
644
+
4. **System complexity**<br />Disabled buttons are often used to prevent wasteful clicks, but this puts pressure on the design / implementation to provide robust inline validation. The reality is, inline validation systems can fail, leaving the user stuck with a disabled button and no way to complete the form.
643
645
644
-
</vwc-note>
646
+
### When Disabled Buttons Can Be Useful
647
+
648
+
While disabled buttons often create more problems than they solve, there are limited scenarios where they can improve the user experience if designed carefully:
649
+
650
+
1. **Preventing duplicate submissions**<br />After a critical action such as submitting a payment, booking, or form, the button can be temporarily disabled to avoid multiple clicks and duplicate transactions. This should always be paired with visible feedback (e.g., changing the label to “Processing…” and showing a spinner). We have the [`pending` feature](/components/button/#pending) for this situation.
651
+
2. **Communicating temporary unavailability**<br/>Buttons may be disabled while content is loading or while a dependent process finishes (eg. waiting for a verification SMS). This should be short-lived, and the button state must be updated as soon as the action becomes available.
652
+
653
+
### Best Practices
645
654
646
-
Ensure that the user is able to understand why the action is disabled and what they need to do to enable it.
655
+
- Always provide visible and accessible feedback when a button is disabled (e.g., helper text, inline validation, or an explanatory tooltip).
656
+
- Prefer inline error messages and contextual feedback over disabling buttons—this often gives a clearer and more usable experience.
0 commit comments