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
fix: correct the display of checkbox read-only state (#3328)
* fix(checkbox): adjust read-only styles and add read-only example
This removes some unnecessary read-only styles. Read-only just needs to
override disabled styles; otherwise it uses default styles (for both
default and emphasized).
Also adjusts template to include aria-disabled when in the read-only
state, so screen readers such as VoiceOver do not announce the input
as normal. Note that aria-readonly is not used as it is not announced
property and MDN states that it is "not relevant" for input with type
checkbox.
* fix(fieldgroup): remove incorrect read-only checkbox styles
The previous display of the read-only state, without checkboxes and
displaying commas did not match up with any guidelines. This update is
to make the display of read-only match with what is implemented in
React Spectrum.
It also includes aria-labeledby in the template so the group is
announced by screen readers.
* docs(checkbox): add additional tests for combination of some states
* docs(fieldgroup): display a checked option in readonly fieldgroup
This removes some unnecessary read-only styles. Read-only just needs to override disabled styles. Otherwise it uses the normal styles (for both default and emphasized).
The previous display of the read-only state checkboxes did not match up with any guidelines. This update removes the read-only specific styles for checkbox within the fieldgroup component, so that the boxes are still displayed and commas are not appended to the label. This includes the removal of `--spectrum-fieldgroup-readonly-delimiter` as it is no longer needed.
* Checkboxes allow users to select multiple items from a list of individual items, or mark one individual item as selected.
11
11
*
12
12
* ## Usage notes
13
13
*
14
-
* Checkboxes should not be used on their own. They should always be used within a [field group](/docs/components-field-group--docs). Invalid checkboxes are indicated with an alert [help text](/docs/components-help-text--docs) when included in a Field group.
15
-
*
16
-
* When the label is too long for the horizontal space available, it wraps to form another line.
14
+
* - Checkboxes should not be used on their own. They should always be used within a [field group](/docs/components-field-group--docs).
15
+
* - Invalid checkboxes are indicated with an alert [help text](/docs/components-help-text--docs) when included in a field group.
16
+
* - For more information about the read-only state, see the [read-only checkboxes](/docs/components-field-group--docs#read-only-checkboxes) section of the field group documentation.
17
17
*/
18
18
exportdefault{
19
19
title: "Checkbox",
@@ -62,6 +62,11 @@ Default.args = {
62
62
};
63
63
Default.tags=["!autodocs"];
64
64
65
+
/**
66
+
* Checkboxes can be selected, not selected, or in an indeterminate state. They are in an indeterminate state (shown with a dash icon) when they represent both selected and not selected values.
67
+
*
68
+
* When the label is too long for the horizontal space available, it wraps to form another line.
* The class `is-readOnly` is applied to checkboxes in the read-only state. It's worth noting that `<input type="checkbox">` HTML elements do not have a native `readonly` attribute, and the intended behavior is up to the implementation:
102
+
* - Read-only checkboxes are immutable, i.e. their checked state cannot be changed.
103
+
* - Unlike disabled checkboxes, the checkbox should remain focusable.
0 commit comments