Skip to content

fix: do not trap focus on item Tab, extract keyboard tests #8912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025

Conversation

web-padawan
Copy link
Member

Description

Based on the finding from #8908 (comment)

  • Extracted all tests related to moving focus between buttons to keyboard-navigation.test.js
  • Added missing tests for Tab / Shift + Tab moving focus outside the menu bar to the first or last global focusable
  • Fixed an actual issue where Tab / Shift + Tab on the submenu item trapped focus unexpectedly

Type of change

  • Bugfix

expect(document.activeElement).to.equal(buttons[1]);
});

it('should switch submenu again on subsequent item Arrow Left', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test was added in vaadin/vaadin-menu-bar#24 - back then, the logic was a bit different (it was refactored to KeyboardDirectionMixin much later). So maybe it's not needed anymore, however, I decided to keep it and added a similar test for Arrow Right for consistency.

Copy link
Contributor

@vursen vursen left a comment

Choose a reason for hiding this comment

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

Seems to work correctly now.

@web-padawan web-padawan removed the request for review from sissbruecker April 16, 2025 09:08
@web-padawan web-padawan merged commit 65b62d6 into main Apr 16, 2025
9 checks passed
@web-padawan web-padawan deleted the fix/tab-navigation-keyboard-tests branch April 16, 2025 09:09
web-padawan added a commit that referenced this pull request Apr 16, 2025
…8972)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
web-padawan added a commit that referenced this pull request Apr 16, 2025
…8971)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants