dropdown hot key: Generalize enter behaviour for dropup as well as dropdown.

Also updated comment to more accurately represent that this isn't
only for the gear menu.
This commit is contained in:
evykassirer 2023-03-30 22:02:50 -07:00 committed by Tim Abbott
parent 7f7845eb78
commit 32f75085cb
1 changed files with 2 additions and 2 deletions

View File

@ -397,8 +397,8 @@ function handle_popover_events(event_name) {
// Returns true if we handled it, false if the browser should.
export function process_enter_key(e) {
if ($(".dropdown.open").length && $(e.target).attr("role") === "menuitem") {
// on #gear-menu li a[tabindex] elements, force a click and prevent default.
if ($(".dropdown.open, .dropup.open").length > 0 && $(e.target).attr("role") === "menuitem") {
// on dropdown menu elements, force a click and prevent default.
// this is because these links do not have an href and so don't force a
// default action.
e.target.click();