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

Fix dirtyFormCheck alerts in Safari #2793

Closed
wants to merge 1 commit into from

Conversation

JoshBarr
Copy link
Contributor

In testing, Safari returns body for event.explicitOriginalTarget || document.activeElement. Therefore, we need to store a reference to the last clicked $ignoredButtons to hide the confirm dialog from being displayed.

In testing, Safari returns `body` for `event.explicitOriginalTarget || document.activeElement`. Therefore, we need to store a reference to the last clicked `$ignoredButtons` to hide the confirm dialog from being displayed.
@gasman
Copy link
Collaborator

gasman commented Jul 1, 2016

After tearing my hair out trying to test this, I think beforeunload handling on Safari (9.1) is too buggy for us to support. Based on a trivial test page:

<!DOCTYPE HTML>
<html>
    <head>
        <script>
            window.addEventListener('beforeunload', function(event) {
                event.returnValue = "leave this page?";
                return "leave this page?";
            });
        </script>
    </head>
    <body>
        <a href="http://torchbox.com">leave</a>
    </body>
</html>

once the prompt appears and is dismissed once, it never appears again, even after a force refresh, unless you quit the browser or re-enter the URL manually. I'm now working on a new solution based on #2801 that doesn't rely on checking button clicks at all, and hopefully avoids browser-specific special cases.

@gasman
Copy link
Collaborator

gasman commented Jul 1, 2016

Closing in favour of #2811 - testing the buttons/links that initiated the beforeunload event seems to be inherently unreliable across browsers (and fails to consider keyboard events), and we should use an approach that doesn't depend on it.

@gasman gasman closed this Jul 1, 2016
@kaedroho kaedroho deleted the fix/safari-dirtyform branch July 18, 2016 13:55
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

Successfully merging this pull request may close these issues.

None yet

2 participants