Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Pressing ESC with a dropdown inside a modal dialog #5778

Closed
asfordmatt opened this issue Apr 11, 2016 · 3 comments
Closed

Pressing ESC with a dropdown inside a modal dialog #5778

asfordmatt opened this issue Apr 11, 2016 · 3 comments

Comments

@asfordmatt
Copy link

Bug description:

If I have a dropdown widget inside a modal dialog and the dropdown is open, and then I press Escape, it closes the dialog. I would expect pressing Escape to close the dropdown only and not the dialog as well. If the dropdown is closed, pressing Escape would then close the dialog. Could this be addressed by calling evt.stopPropagation() when handling the escape key in dropdown.js?

Link to minimally-working plunker that reproduces the issue:

http://plnkr.co/edit/T2gDRud9wpg8XpbLu3Yc?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.3

UIBS: 1.3.1

Bootstrap: 3.3.6

@deeg
Copy link
Contributor

deeg commented Apr 11, 2016

Since esc closes typeahead and dropdowns I would argue both should behave the same way. If making a PR to fix for dropdown, please make sure typeahead works the same way.

@wesleycho
Copy link
Contributor

Marking as a breaking change, but the side-effects should be minimal, if it affects anyone at all.

Looks like we do close a dropdown on escape, so it makes sense to stop the event propagation.

@asfordmatt
Copy link
Author

@deeg good call, I agree typeahead should work the same way - in fact it already works the way I think the dropdown should work. It stops event propagation so that ESC only closes the typeahead dropdown not the dialog as well. I created a plunkr to test it out:
http://plnkr.co/edit/Drvukb7zDOISdEfBXM1C?p=preview

deeg added a commit to deeg/bootstrap that referenced this issue Apr 12, 2016
Fixes angular-ui#5778

BREAKING CHANGE: Stops propagation of keydown event when escape key is pressed. Removes keydown event from the document and moves it to the dropdown element.
deeg added a commit to deeg/bootstrap that referenced this issue Apr 12, 2016
Fixes angular-ui#5778
Closes angular-ui#5787

BREAKING CHANGE: Stops propagation of keydown event when escape key is pressed. Removes keydown event from the document and moves it to the dropdown element.
deeg added a commit to deeg/bootstrap that referenced this issue Apr 12, 2016
Fixes angular-ui#5778
Closes angular-ui#5787

BREAKING CHANGE: Stops propagation of keydown event when escape key is pressed. Removes keydown event from the document and moves it to the dropdown element.
@deeg deeg closed this as completed in 68200bb Apr 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants