When closing a tab or navigating away from the page we should warn the user if they have unsaved changes. This is done with the onbeforeunload handler.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Add beforeunload handlers | mediawiki/extensions/DiscussionTools | master | +52 -3 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T233443 [Epic] Reply Tool | |||
Resolved | ppelberg | T235923 Replies v1.0: release replying to specific comments | |||
Resolved | • iamjessklein | T236921 Replies v1.0: conduct usability testing | |||
Resolved | ppelberg | T240259 Implement `unload handlers` for compose |
Event Timeline
Change 556204 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/DiscussionTools@master] Add beforeunload handlers
Change 556204 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Add beforeunload handlers
@Esanders: I am getting this warning message from the browser when I am closing the tab without posting a reply that I typed. Also, while navigating away to the other tabs except "Edit Source" tab.
When I type a reply and click on "Edit Source" tab, it navigates away from the page without giving any warning.
Is it the correct behavior?
My theory is that @Ryasmeen has NWE enabled, and so "edit source" isn't technically a navigation event (because it's just replacing the contents of the current page). We need to special case detecting and canceling this somehow.
@Ryasmeen If you don't have NWE enabled, let me know, because that'd demolish my theory. 😁
@DLynch: You are right :) I had NWE enabled, this doesn't happen when switching to old wikitext editor.
Good spot, @DLynch.
David, can you describe this in a bit more detail? Does "special case detecting and cancelling" refer to writing a patch to make it so the browser displays a warning message [1] before contributors who a) have NWE enabled and b) have started writing a reply click "Edit source"?
- Browser warning message: "Leave site? / Changes you made may not be saved."
Understood. If you have a task already written, please feel free to close this one as a duplicate: T244942