Problem/Motivation

Getting a Duplicate of modal popup during exiting the page. Might be the issue with other JS attach behaviours.

Steps to reproduce

Add a custom block and attach to the page. Exit from the tab and check.

Attach external JS with document ready attach behaviours.

Proposed resolution

Control the triggering element by adding once().

$(document).bind('mouseleave', function (e) {

$(document).once().bind('mouseleave', function (e) {

Remaining tasks

Nil

User interface changes

Nil

API changes

Nil

Data model changes

Nil

Issue fork exit_modal-3192275

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

arunkumark created an issue. See original summary.

arunkumark’s picture

Issue summary: View changes
mohit.bansal623’s picture

Status: Active » Needs review
StatusFileSize
new467 bytes

Please review this patch.

nmatja’s picture

StatusFileSize
new3.85 KB
new7.58 KB

I spotted that patch #3 did not resolve the issue. After popup closing each "mouseleave" event executed the event listener.

I updated the patch and inserted the drupal standards.

admirlju made their first commit to this issue’s fork.

admirlju’s picture

Status: Needs review » Reviewed & tested by the community

To make it easier for maintainers create a merge request. Applied the #4 patch and tested it. From my tests, it correctly opens the dialog when a user tries to close the page.

I think this should eventually be reworked to not use jQuery as that will (hopefully) one day be deprecated. But the patch fixes this particular issue, so RTBC.