Skip to content

Commit 50bf94f

Browse files
committed
EuiSelectableListItem - fix Duplicated announcement for checked options
1 parent 9a6e168 commit 50bf94f

File tree

6 files changed

+222
-729
lines changed

6 files changed

+222
-729
lines changed

packages/eui/src/components/accessibility/screen_reader_only/screen_reader_only.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,34 @@ export interface EuiScreenReaderOnlyProps {
2222
* For keyboard navigation, force content to display visually upon focus/focus-within.
2323
*/
2424
showOnFocus?: boolean;
25+
26+
/**
27+
* Optional CSS class(es) to apply to the outermost element of the component.
28+
* This allows for custom styling or theming.
29+
*/
2530
className?: string;
31+
32+
/**
33+
* Optional HTML id attribute for the outermost element.
34+
* Can be used for linking with labels, aria attributes, or targeting the element.
35+
*/
36+
id?: string;
2637
}
2738

2839
export const EuiScreenReaderOnly: FunctionComponent<
2940
EuiScreenReaderOnlyProps
30-
> = ({ children, className, showOnFocus }) => {
41+
> = ({ children, className, showOnFocus, id }) => {
3142
const classes = classNames(className, children.props.className);
3243

3344
const props = useMemo(
3445
() => ({
46+
id: id || children.props.id,
3547
className: classes.length ? classes : undefined,
3648
css: showOnFocus
3749
? styles['euiScreenReaderOnly-showOnFocus']
3850
: styles.euiScreenReaderOnly,
3951
}),
40-
[classes, showOnFocus]
52+
[id, children.props.id, classes, showOnFocus]
4153
);
4254

4355
return cloneElementWithCss(children, props);

0 commit comments

Comments
 (0)