Closed daiplusplus closed 4 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!
and we'll verify it.
ℹ️ Googlers: Go here for more info.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!
and we'll verify it.
ℹ️ Googlers: Go here for more info.
@googlebot I signed it!
Thanks!
In my application, I detect clicks on the backdrop by comparing the
MouseEvent
's x and y coordinates to the dialog's box dimensions and closing the dialog if the user clicked on the backdrop.However I can't simply use the 'click' event because my dialogs are resizable (using the browser native resize grip in the bottom-right corner of the dialog). If a user drags the resize handle to make the dialog bigger - and if the dialog has a
max-width
and/ormax-height
and the user keeps on dragging the mouse cursor and releases their mouse button over the backdrop then the 'click' event is raised with theMouseEvent
coordinates over the backdrop - so I use the mouseup and mousedown events to detect if the mouse moved between the backdrop and the dialog-proper (again, by comparing coordinates of the MouseEvent with the size of the dialog-proper), and based on that it either ignores the click or it closes the dialog.My solution works with this Polyfill library, but I first needed to invoke the
backdropClick_
function formouseup
andmousedown
events - so this is me contributing those trivial changes back.