Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/feedback/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export default function Popover({
data-testid="popover"
data-component="Popover"
>
{children}
{open && children}
</div>
);
}
23 changes: 11 additions & 12 deletions src/components/feedback/test/Popover-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ function TestComponent({ children, ...rest }) {
Anchor element
</button>
<Popover open={open} anchorElementRef={buttonRef} {...rest}>
{open &&
(children ?? (
<>
Content of popover
<button
data-testid="inner-button"
onClick={() => setOpen(prev => !prev)}
>
Focusable element inside popover
</button>
</>
))}
{children ?? (
<>
Content of popover
<button
data-testid="inner-button"
onClick={() => setOpen(prev => !prev)}
>
Focusable element inside popover
</button>
</>
)}
</Popover>
</div>
);
Expand Down
3 changes: 1 addition & 2 deletions src/components/input/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,9 @@ function SelectMain<T>({
aria-multiselectable={multiple}
aria-labelledby={buttonId ?? defaultButtonId}
aria-orientation="vertical"
data-listbox-open={listboxOpen}
onScroll={onListboxScroll}
>
{listboxOpen && children}
{children}
</ul>
</Popover>
</SelectContext.Provider>
Expand Down
2 changes: 1 addition & 1 deletion src/components/input/test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('Select', () => {
const toggleListbox = wrapper => getToggleButton(wrapper).simulate('click');

const isListboxClosed = wrapper =>
wrapper.find('[role="listbox"]').prop('data-listbox-open') === false;
wrapper.find('Popover').prop('open') === false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only change needed to fix a bunch of failing Select tests.


const openListbox = wrapper => {
if (isListboxClosed(wrapper)) {
Expand Down