@adobe-commerce/elsie 2.1.0 → 2.1.1-alpha-20260925111903
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @adobe-commerce/elsie
|
|
2
2
|
|
|
3
|
+
## 2.1.1-alpha-20260925111903
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e06c05f: fix(a11y): Checkbox now derives its internal label/description ids
|
|
8
|
+
from the unique `id` prop when provided, instead of the (often shared) `name`
|
|
9
|
+
prop, so two checkboxes with the same `name` no longer produce duplicate DOM
|
|
10
|
+
ids that cause screen readers to announce the wrong checkbox's label (WCAG
|
|
11
|
+
4.1.2)
|
|
12
|
+
- 641d4f5: fix(a11y): Picker's accessible name now prefers the human-readable
|
|
13
|
+
floating label or placeholder over the raw `name` attribute, so screen readers
|
|
14
|
+
announce the same text sighted users see instead of an internal field
|
|
15
|
+
identifier (WCAG 2.5.3)
|
|
16
|
+
|
|
3
17
|
## 2.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -39,12 +39,14 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
39
39
|
description = '',
|
|
40
40
|
className,
|
|
41
41
|
checked,
|
|
42
|
+
id,
|
|
42
43
|
...props
|
|
43
44
|
}) => {
|
|
44
45
|
const [isChecked, setIsChecked] = useState(
|
|
45
46
|
checked === undefined ? false : checked,
|
|
46
47
|
);
|
|
47
48
|
const ref = useRef<HTMLInputElement>(null);
|
|
49
|
+
const baseId = id ?? name;
|
|
48
50
|
|
|
49
51
|
const handleCheckboxChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
50
52
|
props.onChange?.(e);
|
|
@@ -73,6 +75,7 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
73
75
|
>
|
|
74
76
|
<input
|
|
75
77
|
ref={ref}
|
|
78
|
+
id={id}
|
|
76
79
|
name={name}
|
|
77
80
|
value={value}
|
|
78
81
|
type="checkbox"
|
|
@@ -92,8 +95,8 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
92
95
|
{'\u200B'}
|
|
93
96
|
<span
|
|
94
97
|
aria-checked={isChecked ? 'true' : 'false'}
|
|
95
|
-
aria-labelledby={`${
|
|
96
|
-
aria-describedby={description ? `${
|
|
98
|
+
aria-labelledby={`${baseId}-label`}
|
|
99
|
+
aria-describedby={description ? `${baseId}-description` : undefined}
|
|
97
100
|
className={classes([
|
|
98
101
|
'dropin-checkbox__box',
|
|
99
102
|
['dropin-checkbox__box--error', error],
|
|
@@ -113,7 +116,7 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
113
116
|
</div>
|
|
114
117
|
|
|
115
118
|
<div
|
|
116
|
-
id={`${
|
|
119
|
+
id={`${baseId}-label`}
|
|
117
120
|
className={classes([
|
|
118
121
|
'dropin-checkbox__label',
|
|
119
122
|
`dropin-checkbox__label--${size}`,
|
|
@@ -126,7 +129,7 @@ export const Checkbox: FunctionComponent<CheckboxProps> = ({
|
|
|
126
129
|
<div />
|
|
127
130
|
{description && (
|
|
128
131
|
<div
|
|
129
|
-
id={`${
|
|
132
|
+
id={`${baseId}-description`}
|
|
130
133
|
role={'note'}
|
|
131
134
|
className={classes([
|
|
132
135
|
'dropin-checkbox__description',
|
|
@@ -89,7 +89,7 @@ export const Picker: FunctionComponent<PickerProps> = ({
|
|
|
89
89
|
const isRequired = !!props?.required;
|
|
90
90
|
const isDisabled = disabled || (disableWhenSingle && options?.length === 1);
|
|
91
91
|
const selectRef = useRef<HTMLSelectElement>(null);
|
|
92
|
-
const accessibleName =
|
|
92
|
+
const accessibleName = floatingLabel || placeholder || name;
|
|
93
93
|
|
|
94
94
|
// find the first option that is not disabled
|
|
95
95
|
const firstAvailableOption = options?.find((option) => !option.disabled);
|