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
Copy file name to clipboardExpand all lines: 1st-gen/packages/button/clear-button.md
+17-29Lines changed: 17 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,34 +25,21 @@ import { ClearButton } from '@spectrum-web-components/button';
25
25
26
26
### Anatomy
27
27
28
-
The clear button is a button with only close icon.
28
+
The clear button is a button with only a close icon.
29
29
30
30
```html
31
-
<sp-clear-button>Reset</sp-clear-button>
31
+
<sp-clear-buttonlabel="Reset"></sp-clear-button>
32
32
```
33
33
34
34
#### Label
35
35
36
-
The label for an `<sp-clear-button>` element can be set via it's default slot or with the `label` attribute. With either method, the label will not be visible but still read by screen readers.
37
-
38
-
<sp-tabsselected="attribute"autolabel="Labelling a button">
39
-
<sp-tabvalue="slot">Default slot</sp-tab>
40
-
<sp-tab-panelvalue="slot">
41
-
42
-
```html demo
43
-
<sp-clear-button>Clear</sp-clear-button>
44
-
```
45
-
46
-
</sp-tab-panel>
47
-
<sp-tabvalue="attribute">Label attribute</sp-tab>
48
-
<sp-tab-panelvalue="attribute">
36
+
An accessible label for an `<sp-clear-button>` must be provided using the `label` attribute. This sets the `aria-label` for screen readers. Unlike other button types, the clear button only displays an icon and does not render slot content, so the `label` attribute is the only way to provide an accessible name.
A button is required to have either text in the default slot or a `label` attribute on the `<sp-clear-button>`.
148
+
A button is required to have a `label` attribute on the `<sp-clear-button>` to provide an accessible name for screen readers. The `label` attribute sets the `aria-label` property, ensuring the button is properly announced to assistive technologies.
0 commit comments