2-finger swipe gesture navigation discards user's work unnecessarily

Originator:BrunoGTorquato
Number:rdar://19163478 Date Originated:05-Dec-2014 07:09 PM
Status:Open Resolved:
Product:Safari OSX Product Version:7.1 (9537.85.10.17.1)
Classification: Reproducible:yes
 
Summary:
There is a handy bit of javascript that can help users preserve their work in case they accidentally click the back or reload button while creating content. It displays a confirmation dialog, and if the user chooses not to navigate away, nothing happens. 

"Are you sure you want to leave this page?", Safari asks.
No, "Stay On Page", clicks the user.
(nothing happens and everyone is happy)

The problem occurs if the user triggers the back command by swiping with the trackpad. The dialog still appears. That's actually great, only now, if the user chooses not to navigate away, Safari… navigates away and the user loses all their work. This is particularly egregious when one considers the much greater likelihood of accidentally triggering the back command by swiping (which shares gestures with the decidedly safe scrolling action).

The user is just scrolling around a web application where they have spent a considerable amount of time doing some important work.
Safari asks, "Are you sure you want to leave this page?"
No, clicks the user, "Stay On Page", thinking, "Phew, good thing it caught my accidental navigation"
(Safari ignores the user's request and breaks the tab, showing a blank page)
The user screams loudly.

Steps to Reproduce:
1. Unzip the attached archive
2. Open "Leave Me.html"
3. Click the link labeled "Go to Page 2"
4. Type a novel into the text area on page 2
5. Click Safari's "Back" button
6. Click "Stay on Page" in the resulting dialog
7. Breathe a sigh of relief as all your work is preserved
8. Swipe with 2 fingers from the left of your trackpad to the right
9. Click "Stay on Page" in the resulting dialog


Expected Results:
The swiped away page should become visible again (ideally by sliding back from where it was swiped to), and the user should not lose any of their hard work.

Bonus points if you find a way to keep the swiped-away page partially visible while the confirmation dialog is shown.

Actual Results:
A broken blank white page appears.

Version:
Safari Version Version 7.1 (9537.85.10.17.1)
on
OS X 10.9.5

These are the latest versions I have tested on, but it has been occurring for a long time now.

Notes:


Configuration:
Using a Trackpad
"Swipe between pages (Scroll left or right with 2 fingers)" Enabled in System Preferences

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!