Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pressing ESC during showModal sometimes doesnt close the dialog #45

Closed
zmandel opened this issue Mar 31, 2015 · 3 comments
Closed

pressing ESC during showModal sometimes doesnt close the dialog #45

zmandel opened this issue Mar 31, 2015 · 3 comments

Comments

@zmandel
Copy link

@zmandel zmandel commented Mar 31, 2015

If a page already has a handler for "ESC", and you show a modal dialog, the "ESC" event is trapped by the previous handler and not by the dialog.
In my case, I use this great polyfill in an open-source chrome extension: https://github.com/zmandel/Plus-for-Trello/blob/1c2fa9ca36327211834fd8f2933cfb47ad69ecf1/source/card.js#L360
and in that line you can see that I had to manually catch the keydown and close()
That dialog code is injected into a trello "card" (trello.com) and without it Trello will close the card and leave my dialog floating. Not sure if this is specific with being on a chrome extension.

@mfalken
Copy link
Member

@mfalken mfalken commented Apr 1, 2015

Thanks for reporting. I think the polyfill doesn't go out of its way to be the "top" handler for keyboard presses. BTW, if this is for a Chrome extension, you can just use the native <dialog> instead of the polyfill, as Chrome supports <dialog>.

@samthor
Copy link
Member

@samthor samthor commented Apr 1, 2015

I'll take a look, but +1 to @mattto: if you're writing a Chrome extension, you don't need this polyfill at all.

@zmandel
Copy link
Author

@zmandel zmandel commented Apr 1, 2015

It depends on the version of chrome. Some people use older versions thus I use the polyfill

@samthor samthor closed this Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.