Skip to content

Commit

Permalink
refactor: use native Tab order when leaving popover content
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Jul 31, 2024
1 parent 85ab3b9 commit 50b7f25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/popover/src/vaadin-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,7 @@ class Popover extends PopoverPositionMixin(
if (lastFocusable && isElementFocused(lastFocusable)) {
const focusable = this.__getNextBodyFocusable(this.target);
if (focusable && focusable !== overlayPart) {
event.preventDefault();
focusable.focus();
this.target.focus();
return;
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/popover/test/a11y.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,10 @@ describe('a11y', () => {
// Move focus to the input inside the overlay
await sendKeys({ press: 'Tab' });

const spy = sinon.spy(input, 'focus');

// Move focus to the input after the overlay
await sendKeys({ press: 'Tab' });

expect(spy).to.be.calledOnce;
expect(document.activeElement).to.equal(input);
});

it('should focus the last overlay child on the next element Shift Tab', async () => {
Expand Down

0 comments on commit 50b7f25

Please sign in to comment.