v5: Dropdown trigger button "swallows" Esc keypresses when focused
Split off from https://github.com/twbs/bootstrap/issues/23507#issuecomment-805849754 (which is an issue about v4).
If a modal dialog contains a dropdown, Esc
is swallowed/intercepted by the dropdown trigger button even when the dropdown itself is closed.
Instead, the keypress should not be handled when the dropdown is closed, letting it bubble up to the modal.
See the demo https://codepen.io/Jarek3000/pen/LYxVJJg
- launch the modal
-
Tab
to the dropdown button so it receives focus - press
Esc
- nothing happens, as the keypress is intercepted by the modal code