Page MenuHomePhabricator

Abandon changes dialog appears unexpectedly
Closed, ResolvedPublic

Description

As reported here [1], it appears the unload handlers [2] are being fired when they should not be.

Expected behavior

  1. Go to: https://en.wikipedia.beta.wmflabs.org/wiki/Talk:Cats
  2. Click the "Reply" link appended to any comment on the page
  3. Compose a reply in the text input area
  4. Publish your reply
  5. Notice your reply successfully published to the talk page at the level of depth you'd expect it to be published
  6. Notice all "Reply" links are blue
  7. ✅Close the browser tab

Actual behavior

  1. Go to: https://en.wikipedia.beta.wmflabs.org/wiki/Talk:Cats
  2. Click the "Reply" link appended to any comment on the page
  3. Compose a reply in the text input area
  4. Publish your reply
  5. Notice your reply successfully published to the talk page at the level of depth you'd expect it to be published
  6. Notice all "Reply" links are blue
  7. ⚠️Close the browser tab; notice the following confirmation/warning dialog appears: "Changes you made may not be saved."

Please note: I have not been able to reproduce this issue reliably.


  1. https://www.mediawiki.org/w/index.php?title=Topic:Vcwvt3bq03o5gv8h&topic_showPostId=vd8593amh18c3myw#flow-post-vd8593amh18c3myw
  2. T240259

Event Timeline

ppelberg created this task.

This appears to be a side-effect of T241391. After saving a comment and redrawing the page, the last thing we do is remove the system abandon changes dialog, so if there are any bugs before than, that code won't run and the beforeunload handler will still be bound.

Change 565056 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/DiscussionTools@master] Teardown the widget as soon as possible

https://gerrit.wikimedia.org/r/565056

Note - this bug only occurs when there is an error redrawing the page after save, which shouldn't happen, but I've added a fix that does the widget teardown sooner so even if the redraw fails, you won't see the abandon dialog.

Change 565056 merged by jenkins-bot:
[mediawiki/extensions/DiscussionTools@master] Teardown the widget as soon as possible

https://gerrit.wikimedia.org/r/565056