Skip to content

Commit

Permalink
Focus ULS button when the language menu is closed with Escape (#468)
Browse files Browse the repository at this point in the history
Before this, the focus would return to the <body> element (i.e. at
the very top of the document) when you hit the Escape key, instead
of the ULS button, so if you were navigating with the keyboard, you
would have to tab through all preceding focusable elements before
you got back to the language button (and beyond).

Bug: https://phabricator.wikimedia.org/T325009
  • Loading branch information
jhsoby authored Aug 25, 2023
1 parent e19b05b commit b686fe6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/jquery.uls.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@

if ( e.keyCode === 27 ) { // escape
this.cancel();
this.$element.focus();

Check warning on line 331 in src/jquery.uls.core.js

View workflow job for this annotation

GitHub Actions / build (14)

Prefer .on or .trigger to .focus

Check warning on line 331 in src/jquery.uls.core.js

View workflow job for this annotation

GitHub Actions / build (16)

Prefer .on or .trigger to .focus
e.preventDefault();
e.stopPropagation();
}
Expand Down

0 comments on commit b686fe6

Please sign in to comment.