Page MenuHomePhabricator

wgAction = view in edit mode
Closed, DeclinedPublic

Description

In VisualEditor edit mode, wgAction still is "view", correct should is "edit"?

Event Timeline

@Shizhao Hi! I'm afraid I don't understand. Can you give me some more context?

@Shizhao Hi! I'm afraid I don't understand. Can you give me some more context?

see https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Actions

Could you please provide some screenshots so that we know what's wrong in your client? As far as I know by clicking "Edit" on a random "VisualEditor-is-installed" site, the url will include (?/&)veaction=edit rather than any sorts of (?/&)action=


HOWEVER, there's one thing that needs @Jdforrester-WMF attention:

  1. Click any urls that include (?/&)action=edit, e.g. https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit
  2. Click the 2nd "Edit" button
  3. Why on earth the url is still https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit, rather than https://www.mediawiki.org/w/index.php?title=Project:Sandbox&veaction=edit

In VisualEditor edit mode, wgAction still is "view", correct should is "edit"?

No, keeping mw.config.get( 'wgAction' ) as "view" in VisualEditor edit mode was an intentional decision. If we changed it to "edit", we would have caused issues with all the old gadgets that check for this and if it is set, they try to read the value of the edit textbox, which is not there with VisualEditor. If you need to detect if VisualEditor is running, see https://www.mediawiki.org/wiki/VisualEditor/Gadgets#Checking_whether_VisualEditor_is_currently_open (or one of the other snippets on that page, depending on your use case).

Why on earth the url is still https://www.mediawiki.org/w/index.php?title=Project:Sandbox&action=edit, rather than https://www.mediawiki.org/w/index.php?title=Project:Sandbox&veaction=edit

That's a good question, but probably should be a separate task. Note that we're trying to stop using the veaction=edit URLs, it's indeed annoying that we're not simply using action=edit, but this was the best way to solve the above problem when this was being implemented. VE will load with action=edit in the URL in some cases, I think when using single edit tab and it's your default. But in the case you described it probably shouldn't.

I still don't understand the description of the problem. There is a bunch of assumed knowledge in the description that I do not have, and it's not even clear to me where I could go to learn it. How this relates to a user problem or specific action is not described.

Anyway, based on @matmarex's comments, this is a request is to change a feature that has been intentionally designed to be the way it is in order to increase VisualEditor's compatibility with gadgets. Changing that seems unwise.

Based on the above, closing as declined.

I still don't understand the description of the problem. There is a bunch of assumed knowledge in the description that I do not have, and it's not even clear to me where I could go to learn it. How this relates to a user problem or specific action is not described.

You can use mw.config.get( 'wgAction' ) from JavaScript code (or just wgAction, but that's deprecated) to tell what action the user is performing on the page – it will return values like 'view' or 'edit'. The most common purpose for this is to implement gadgets/scripts that only kick in when editing a page. Opening VisualEditor does not affect this value, and the request was to make it do so.

Given it's now been several years, would wgAction now be able to be set to "edit"? And if not, could it be set to something like "veedit" instead? Having wgAction set to "view" while editing the page in VE/2017 seems misleading.