Page MenuHomePhabricator

Submitting or saving edits to a course description prompts a "leave page" warning
Closed, ResolvedPublic

Description

When saving a course description, whether new or edited, pressing the "Submit" button prompts the standard 'data not saved' warning, "This page is asking you to confirm that you want to leave - data you have entered may not be saved." Continuing by pressing "Leave Page" results in the data being saved, however.


Version: unspecified
Severity: critical

Details

Reference
bz39158

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:04 AM
bzimport set Reference to bz39158.
Ragesoss created this task.Aug 8 2012, 4:59 PM

Can't confirm w/o edit rights on test2 or knowing which extension is adding this warning and where. It's probably making some assumptions it should not.

Confirmed, don't know how to kill this though

Similar issue inside UplpoadWizard, reported as bug 38022.

Is this handled at the browser level, perhaps?

I looked at this briefly, I needed more info to test...namely, how do I create a course? It's not clear.

Also, the docs are bad. I should probably add a blocker to bug 1 or something.

My instinct is that, like bug 38022, we're setting an onbeforeunload handler and not _un_setting it, or properly checking state inside of it. That could be bad. But I don't know where that's happening.

Anyway, let me know if I can help further with this, else I'm out.

@mark I've given you the "Education program admin" right on test2.wikipedia.org; you should now be able to create a course from https://test2.wikipedia.org/wiki/Special:Courses

This is caused by https://www.mediawiki.org/wiki/Extension:Vector

Every time an edit page is loaded (or maybe every time *any* page is loaded, the Vector code doesn't appear to actually check for an edit page specifically), it loads the JS that loads in an onbeforeunload event.

This preference can be turned off in "My preferences -> Editing -> Warn me when I leave an edit page with unsaved changes". It's not intuitive, though.

There doesn't appear to be a way to disallow a module on the PHP side, so our only recourse may be to totally remove the onbeforeunload event before submit. As you may imagine, this isn't ideal because A) it loads code we don't use and B) it's adding special treatment where there needn't be any.

Thoughts? Ideas?

I think we want this JS to work, but it should only give the warning when the user leaves the page *without* saving their edits.

Is there a way to modify this extension so that it treats the save/submit action the same way as an edit to a normal page?

It looks like there's a check for some form elements and their values, so I'll see if that makes a difference.

I noticed that the warning doesn't show up unless you use an edit summary. Probably irrelevant once the above fix deploys.

Removed the event handler with https://gerrit.wikimedia.org/r/#/c/25697/

Might not be ideal, but the alternative seems to remove the incorrect assumptions from Vector, which would take a lot more time and block deployment.