Skip to content

Commit d1fded1

Browse files
committed
fix: revert aria-hidden change
1 parent 3df6f36 commit d1fded1

5 files changed

Lines changed: 19 additions & 62 deletions

File tree

packages/pluggableWidgets/combobox-web/src/__tests__/SingleSelection.spec.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,10 @@ describe("Combo box (Association)", () => {
214214
expect(iconWrapper).toHaveAttribute("aria-hidden", "true");
215215
});
216216

217-
it("hides menu list from assistive technologies when closed", () => {
217+
it("does not render menu list when closed", () => {
218218
const component = render(<Combobox {...defaultProps} />);
219219
const menuList = component.container.querySelector(".widget-combobox-menu-list");
220-
expect(menuList).toBeInTheDocument();
221-
expect(menuList).toHaveAttribute("aria-hidden", "true");
220+
expect(menuList).not.toBeInTheDocument();
222221
});
223222

224223
it("renders menu list when open with items", async () => {
@@ -229,7 +228,6 @@ describe("Combo box (Association)", () => {
229228
await waitFor(() => {
230229
const menuList = component.container.querySelector(".widget-combobox-menu-list");
231230
expect(menuList).toBeInTheDocument();
232-
expect(menuList).not.toHaveAttribute("aria-hidden");
233231
expect(component.getAllByRole("option")).toHaveLength(4);
234232
});
235233
});
@@ -246,7 +244,6 @@ describe("Combo box (Association)", () => {
246244
await waitFor(() => {
247245
const menuList = component.container.querySelector(".widget-combobox-menu-list");
248246
expect(menuList).toBeInTheDocument();
249-
expect(menuList).not.toHaveAttribute("aria-hidden");
250247
const placeholder = component.container.querySelector(".widget-combobox-no-options");
251248
expect(placeholder).toBeInTheDocument();
252249
});

packages/pluggableWidgets/combobox-web/src/__tests__/__snapshots__/MultiSelection.spec.tsx.snap

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,7 @@ exports[`Combo box (Association) renders combobox widget 1`] = `
8080
<div
8181
class="widget-combobox-menu widget-combobox-menu-hidden"
8282
style="visibility: hidden; position: fixed;"
83-
>
84-
<ul
85-
aria-hidden="true"
86-
aria-labelledby="comboBox1-label"
87-
class="widget-combobox-menu-list"
88-
id="downshift-0-menu"
89-
role="listbox"
90-
/>
91-
</div>
83+
/>
9284
</div>
9385
</div>
9486
`;
@@ -173,15 +165,7 @@ exports[`Combo box (Association) toggles combobox menu on: input CLICK(focus) /
173165
<div
174166
class="widget-combobox-menu widget-combobox-menu-hidden"
175167
style="visibility: visible; position: fixed; width: 0px; top: 0px; left: 0px;"
176-
>
177-
<ul
178-
aria-hidden="true"
179-
aria-labelledby="comboBox1-label"
180-
class="widget-combobox-menu-list"
181-
id="downshift-0-menu"
182-
role="listbox"
183-
/>
184-
</div>
168+
/>
185169
</div>
186170
</div>
187171
`;
@@ -266,15 +250,7 @@ exports[`Combo box (Association) toggles combobox menu on: input TOGGLE BUTTON 1
266250
<div
267251
class="widget-combobox-menu widget-combobox-menu-hidden"
268252
style="visibility: hidden; position: fixed;"
269-
>
270-
<ul
271-
aria-hidden="true"
272-
aria-labelledby="comboBox1-label"
273-
class="widget-combobox-menu-list"
274-
id="downshift-0-menu"
275-
role="listbox"
276-
/>
277-
</div>
253+
/>
278254
</div>
279255
</div>
280256
`;

packages/pluggableWidgets/combobox-web/src/__tests__/__snapshots__/SingleSelection.spec.tsx.snap

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,7 @@ exports[`Combo box (Association) renders combobox widget 1`] = `
8686
<div
8787
class="widget-combobox-menu widget-combobox-menu-hidden"
8888
style="visibility: hidden; position: fixed;"
89-
>
90-
<ul
91-
aria-hidden="true"
92-
aria-labelledby="comboBox1-label"
93-
class="widget-combobox-menu-list"
94-
id="downshift-0-menu"
95-
role="listbox"
96-
/>
97-
</div>
89+
/>
9890
</div>
9991
</div>
10092
`;

packages/pluggableWidgets/combobox-web/src/__tests__/__snapshots__/StaticSelection.spec.tsx.snap

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,7 @@ exports[`Combo box (Static values) renders combobox widget 1`] = `
8686
<div
8787
class="widget-combobox-menu widget-combobox-menu-hidden"
8888
style="visibility: hidden; position: fixed;"
89-
>
90-
<ul
91-
aria-hidden="true"
92-
aria-labelledby="comboBox1-label"
93-
class="widget-combobox-menu-list"
94-
id="downshift-0-menu"
95-
role="listbox"
96-
/>
97-
</div>
89+
/>
9890
</div>
9991
</div>
10092
`;

packages/pluggableWidgets/combobox-web/src/components/ComboboxMenuWrapper.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ export function ComboboxMenuWrapper(props: ComboboxMenuWrapperProps): ReactEleme
8282
{menuHeaderContent}
8383
</div>
8484
)}
85-
<ul
86-
className={classNames("widget-combobox-menu-list", {
87-
"widget-combobox-menu-highlighted": (highlightedIndex ?? -1) >= 0,
88-
"widget-combobox-menu-lazy-scroll": lazyLoading && !isEmpty
89-
})}
90-
aria-hidden={!isOpen || undefined}
91-
{...menuProps}
92-
>
93-
{isOpen &&
94-
(isEmpty && !isLoading ? <NoOptionsPlaceholder>{noOptionsText}</NoOptionsPlaceholder> : children)}
95-
{isOpen && loader}
96-
</ul>
85+
{isOpen && (
86+
<ul
87+
className={classNames("widget-combobox-menu-list", {
88+
"widget-combobox-menu-highlighted": (highlightedIndex ?? -1) >= 0,
89+
"widget-combobox-menu-lazy-scroll": lazyLoading && !isEmpty
90+
})}
91+
{...menuProps}
92+
>
93+
{isEmpty && !isLoading ? <NoOptionsPlaceholder>{noOptionsText}</NoOptionsPlaceholder> : children}
94+
{loader}
95+
</ul>
96+
)}
9797
{isOpen && menuFooterContent && (
9898
<div tabIndex={0} className="widget-combobox-menu-footer" onMouseDown={PreventMenuCloseEventHandler}>
9999
{menuFooterContent}

0 commit comments

Comments
 (0)