Skip to content

Comments

[UEPR-483] Action Menu Tests#452

Open
kbangelov wants to merge 21 commits intoscratchfoundation:release/UEPR-297-accessibility-improvementsfrom
kbangelov:task/uepr-483-action-menu-tests
Open

[UEPR-483] Action Menu Tests#452
kbangelov wants to merge 21 commits intoscratchfoundation:release/UEPR-297-accessibility-improvementsfrom
kbangelov:task/uepr-483-action-menu-tests

Conversation

@kbangelov
Copy link
Contributor

@kbangelov kbangelov commented Feb 20, 2026

STILL AWAITING MERGE OF #433

Resolves

Part of https://scratchfoundation.atlassian.net/browse/UEPR-483

Proposed Changes

3 Unit tests to test keyboard navigation.

Reason for Changes

Part of Accessibility initiative for Scratch.

@kbangelov kbangelov requested a review from a team as a code owner February 20, 2026 10:39
expect(document.activeElement).toBe(mainButton);
});

test('tab closes menu and focuses next element', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can add a test for shift + tab as well


// Wait 1 second for any menu close animations or timeouts
await new Promise(resolve => setTimeout(resolve, 1000));
expect(document.activeElement).toBe(afterButton);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we also want to check whether the menu is closed as well?

act(() => {
fireEvent.keyDown(firstItem, {key: KEY.ESCAPE});
});
expect(document.activeElement).toBe(mainButton);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here as well - the test name implies we check that the menu is closed, but we only check whether the focus has moved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants