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

Modal dialog and click events on backdrop #30

Closed
xxgreg opened this issue Nov 27, 2014 · 1 comment
Closed

Modal dialog and click events on backdrop #30

xxgreg opened this issue Nov 27, 2014 · 1 comment

Comments

@xxgreg
Copy link

xxgreg commented Nov 27, 2014

I'd like to hookup an event handler to close a modal dialog when the user clicks on the backdrop.

I see that click events for the backdrop are forwarded to the dialog element, but if I add a click handler here it will also cause the dialog to close if I click on the dialog itself.

Is there a way to distinguish between a click event on the dialog itself versus the backdrop?

@samthor
Copy link
Contributor

samthor commented Jul 4, 2015

I know this is an old bug, but I suspect the right way to do this is to add a wrapping div to your dialog. If you get an event on that, it's on the dialog: if you get something on the dialog, it's on the backdrop.

This matches the spec, where there's literally no way to tell them apart. The polyfill is hiding the fact that the backdrop is a real element.

@samthor samthor closed this as completed Jul 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants