Fix modal closing issue - check e.target directly
The previous fix using closest() was incorrect because closest('.modal')
would always return the modal for any click inside it (including dialog).
The correct approach is to check if e.target IS the modal element itself,
which only happens when clicking directly on the backdrop overlay,
not when clicking on elements inside the dialog.
Showing
Please
register
or
sign in
to comment