Merge pull request #10 from ndarilek/dropdown-a11y

When a dropdown is open, block Tab to avoid navigating away.
This commit is contained in:
Chris McCord 2021-11-22 14:29:04 -05:00 committed by GitHub
commit 982e626424
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,6 +87,8 @@ Hooks.Menu = {
let menuItems = this.menuItems()
this.deactivate(menuItems)
this.activate(menuItems.indexOf(this.activeItem) - 1, menuItems.length - 1)
} else if (e.key === "Tab"){
e.preventDefault()
}
}
}