-
Notifications
You must be signed in to change notification settings - Fork 83
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
refactor: make overlay use FocusTrapController #3159
refactor: make overlay use FocusTrapController #3159
Conversation
it('should not focus next focusable element inside the content when Tab is prevented', async () => { | ||
overlay.addEventListener('keydown', (event) => { | ||
if (event.key === 'Tab') { | ||
event.preventDefault(); | ||
} | ||
}); | ||
overlay.opened = true; | ||
await oneEvent(overlay, 'vaadin-overlay-open'); | ||
tabKeyDown(focusableElements[overlay._focusedIndex()]); | ||
expect(overlay._focusedIndex()).to.equal(0); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was previously possible to prevent the focus trap logic on keydown
by calling preventDefault()
on the event (see the check). It was introduced as a workaround for vaadin/vaadin-rich-text-editor#125.
However, it appears that over time the mentioned issue was fixed directly in the rich text editor library as I wasn't able to reproduce it even without the workaround. Considering this, I decided to drop the workaround at all.
258abb1
to
56a9ceb
Compare
85d3dc6
to
50f124e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the one untested condition, lgtm
50f124e
to
f261503
Compare
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
f261503
to
51b562d
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This ticket/PR has been released with platform 23.0.0.alpha1 and is also targeting the upcoming stable 23.0.0 version. |
Description
The PR drops the focus trap logic from the overlay component and makes it use
FocusTrapController
instead.Depends on #3140
Fixes #3134
Type of change
Checklist