Skip to content
Merged
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
13 changes: 9 additions & 4 deletions packages/components/src/menu/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe( 'Menu', () => {
await waitForFocusedMenuItem( 'First item' );
} );

it( 'should open and focus the first item when pressing the space key on the trigger', async () => {
it( 'should open when pressing the space key on the trigger', async () => {
render(
<Menu>
<Menu.TriggerButton>Open dropdown</Menu.TriggerButton>
Expand All @@ -181,11 +181,16 @@ describe( 'Menu', () => {
expect( screen.queryByRole( 'menuitem' ) ).not.toBeInTheDocument();

// Keyboard-triggered clicks have `detail: 0`, which Ariakit uses to
// choose the initial item focus path instead of the pointer path.
// distinguish keyboard activation from pointer activation.
await press.Space( toggleButton, { detail: 0 } );

// Menu open, focus is on the first focusable item
await waitForFocusedMenuItem( 'First item' );
await waitFor( () =>
expect( toggleButton ).toHaveAttribute(
'aria-expanded',
'true'
)
);
expect( screen.getByRole( 'menu' ) ).toBeVisible();
} );

it( 'should close when pressing the escape key', async () => {
Expand Down
Loading