Page MenuHomePhabricator

Make action=edit with 2010 wikitext editor a full-width page in Vector-2022
Closed, ResolvedPublic3 Estimated Story Points

Description

Ensure that the page that Wikitext 2010 editor exists inside of is being treated as a wide page in the new vector so that editors may make use of the full real-estate on the screen when using the new tool.

See https://phabricator.wikimedia.org/T307042 for more details

Acceptance Criteria

  • Exclude Visual Editor + New Wikitext Editor from this change

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@Jdlrobson hello there! nice to meet you, I'm the PM for CommTech! 😄

Wanted to add context that this page should always be wide the way that Special Pages like the History page get treated in new vector, i.e. this page should not be switching between wide/not wide. It should default to wide.

This comes as a result of multiple conversations with the designers and product managers of the Web Readers, Editing, and CommTech teams! Will follow up with documentation.

Apologies for the radio silence on this ticket on my end and hope this helps shepherd this ticket forward so that we can launch to the rest of the pilots. This ticket is a blocker to that. https://phabricator.wikimedia.org/T303961

Thanks so much!

@nray / @Jdrewniak could you please take a look at the Gerrit patch here and confirm you have no issues with the approach we are taking here?

One problem with the front-end only solution for this is that there's a loading delay and the editing form moves around when the page first opens.

I don't mean to drag this out even longer, but I wonder about going back to my first suggestion above of modifying $wgVectorMaxWidthOptions to include action=edit. That'd avoid any loading issues. 793354 is a proof of concept for that.

Or alternatively and I guess in combination with the JS hook approach, add a PHP hook that also enables max-width. That's probably better isn't it? I'll add that.

Change 800543 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Disable Vector-2022's max-width when editing with Realtime Preview

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

I don't mean to drag this out even longer, but I wonder about going back to my first suggestion above of modifying $wgVectorMaxWidthOptions to include action=edit. That'd avoid any loading issues. 793354 is a proof of concept for that.

I think that's a good option, I just don't know how this would interact with VisualEditor which presumably should not have the max width.

Or alternatively and I guess in combination with the JS hook approach, add a PHP hook that also enables max-width. That's probably better isn't it? I'll add that.

If a JS hook is not needed I suggest we just add the PHP hook, rather tha nboth.

Have left lots of feedback on the respective patches.

Change 801015 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/skins/Vector@master] In max-width mode, constrain the width of page previews

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

Change 801335 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/skins/Vector@master] Make the skin-vector-disable-max-width CSS class name reusable

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

Change 797864 abandoned by Samwilson:

[mediawiki/extensions/WikiEditor@master] Realtime Preview: Full-width editing for Vector-2022

Reason:

A front-end only solution isn't going to work for this.

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

Change 793354 abandoned by Samwilson:

[mediawiki/skins/Vector@master] Make the editing form max-width, but the preview still narrow

Reason:

Useful parts moved to other change.

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

Change 797856 abandoned by Samwilson:

[mediawiki/skins/Vector@master] Add new PHP hook VectorMaxWidthHook for changing the max-width options

Reason:

In favour of https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/801335

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

Change 801349 had a related patch set uploaded (by Samwilson; author: Samwilson):

[integration/config@master] Add `skins/Vector` as dependency to `WikiEditor`

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

Change 801015 merged by jenkins-bot:

[mediawiki/skins/Vector@master] In max-width mode, constrain the width of page previews

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

@NRodriguez, just to confirm, the expected state would be:

VE and new wikitext editor will load at limited width
2010 wikitext editor: will load at full width

Change 793354 restored by Samwilson:

[mediawiki/skins/Vector@master] Make the editing form max-width, but the preview still narrow

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

@NRodriguez, just to confirm, the expected state would be:
VE and new wikitext editor will load at limited width
2010 wikitext editor: will load at full width

@ovasileva correct, this is only for Wikitext 2010 editor, not VE, which is coupled with New Wikitext editor

Change 801349 abandoned by Samwilson:

[integration/config@master] Add `skins/Vector` as dependency to `WikiEditor`

Reason:

Not needed with https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/793354

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

Change 800543 abandoned by Samwilson:

[mediawiki/extensions/WikiEditor@master] Disable Vector-2022's max-width when editing with Realtime Preview

Reason:

Not needed with https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/793354

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

Change 801335 abandoned by Samwilson:

[mediawiki/skins/Vector@master] Make the skin-vector-disable-max-width CSS class name reusable

Reason:

Not needed with https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/793354

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

Change 793354 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Exclude from max-width via query string patterns

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

Thanks for your help with all this @Jdlrobson.

The problem with VE comes when $wgVisualEditorUseSingleEditTab = true (which is the case in many Wikimedia wikis), because in that situation VE treats action=edit the same as veaction=edit (for the edit tab and section edit links). (As an aside, isn't this creating dramas for various user scripts, lots of which seem to check for mw.config.get( 'wgAction' ) === 'edit'?)

There are a few issues with resolving this for VisualEditor, I think. The following seem to be key points:

  • WikiEditor shouldn't be responsible for determining page width, any more than special pages, history, or diffs should be.
  • VisualEditor also shouldn't care about page width.
  • Vector shouldn't know about VE or any extension, but it's also what's responsible for setting the width, so if we want different widths for different editors (or the other things, which it's already doing) then I can't see how we can do it without Vector inspecting for VE (i.e. defaulting to wide but explicitly making VE narrow).

Core does have the concept of a custom editor (i.e. CustomEditorHook), but there doesn't seem to be a way to get a name for a custom editor. Perhaps that'd be a useful addition?

Change 802427 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/skins/Vector@master] Add $wgVectorMaxWidthOptions['exclude']['editors'] to avoid max-width in VE

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

Jdlrobson added a subscriber: Esanders.

Hi editing team (particularly @Esanders). I could do with some input on this Community tech team patch. Basically, we want to make it possible to turn features on/off based on which editor is being used. Is there a way we can avoid having to know a thing or two about VisualEditor's internals?

Change 802685 had a related patch set uploaded (by Samwilson; author: Samwilson):

[operations/mediawiki-config@master] Update $wgVectorMaxWidthOptions to include action=edit

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

I and @Jdlrobson had a talk about this problem earlier today, and we came up with the following points:

  • The changes already made above will now allow us (via a simple config change) to make the wikitext editor wide. We could enable that next week after the train.
  • However, that would mean that VE (where it is set as the default editor either via config or user preference) would in certain circumstances also end up wide. That wouldn't happen when just clicking an edit link, nor when a user or wiki has both edit tabs visible. It does look like it'd be pretty rare, but it's definitely an issue. It's due to VE taking over action=edit in some situations (one fix for this might be for VE to redirect to veaction=edit instead).
  • We don't want to add code to Vector that depends on VE, even if it's conditional. The patch above adds a config for changing Vector's behaviour based on which editor is in use, but because core doesn't have a concept of 'editor' this isn't very workable.
  • The best fix for all this is probably to separate action and give core a new editor URL param (and that concept in general), so that it's always explicit what editor is in use. There's also a fair bit of simplifying that could happen to user preferences, rather than making VE and WikiEditor seem like such different things. But all of that is outside the scope of this task and will take too long for this project.
  • Another approach could be to add to Vector a new max-width config based on preference values. This could then look at usebetatoolbar, visualeditor-tabs, and others to determine whether max-width should apply. We couldn't quickly see an easy way to express this as a config variable, but perhaps this could be investigated further. It might be the more robust involve less direct mixing of codebases.

All up, the approach of making action=edit always max width is the best, with the caveat that we'll then immediately follow-up with making sure that VE handles switching between editors correctly (and uses veaction=edit everywhere). This might make some extra work for the editing team, if just in reviewing our work.

Of course, if anyone's got any ideas, please share them! :-)

In short here are the options:

  1. Add configuration change, work on T309882

Cons: Visiting edit URL directly e.g. https://en.wikipedia.org/wiki/Banana_slug?action=edit would load VisualEditor without max-width. This should hopefully be a rare case but I leave that judgement to @ovasileva . We can collect data to back this decision if necessary.

  1. Block on editing team and T309882

Cons: Delays roll out for community tech team, but doesn't cause any problems to VisualEditor or add technical debt.

  1. Add technical debt to Vector to work around the problem.

Cons: That would be technical debt the web team is not willing to take on at the current time. As a compromise, we could add this if there is an agreement for a more long-term solution. We could perhaps reduce technical debt by finding a solution using preferences but that will take more analysis on the web team side.

AFAIK you should be able to tell which editor is open from CSS classes. At least with VE you get ve-active on html tag. Plain editor is both for action-submit and action-edit (on body) which makes things a bit weird as it is almost the same view.

Anyway I think you could even do a MutationObserver to add or remove skin-vector-disable-max-width or just add VE class to Vector's CSS. Not sure if you would consider those options as a small or big dependency, but classes are usually most stable part of MW in my experience. I guess you could also easily make sure to add some stable classes for each editor being opened...

Do note that sticky toolbar of VE will not resize once VE was loaded (removing skin-vector-disable-max-width will not change it's width). So that might be a no-go if you want to make sure VE is thin... But I guess it could also be fixed on the VE side.

Visiting edit URL directly e.g. https://en.wikipedia.org/wiki/Banana_slug?action=edit would load VisualEditor without max-width. This should hopefully be a rare case

This would also happen if e.g. a user is editing wikitext and then switches to visual. The URL stays as action=edit.

AFAIK you should be able to tell which editor is open from CSS classes.

That's true, but the issue is that Vector shouldn't make that determination, VisualEditor should. Vector should make it possible to toggle the class name (although I'm not sure that is such a bad dependency; as you say, class names are reasonably often considered stable).


We're hoping to deploy Realtime Preview to more wikis from next week, but are blocked on this task.

At the moment, I think we should deploy the config change right now. Then we can follow up and either add an 'editor' concept to core, or just fix VE so that it correctly changes the skin-vector-disable-max-width class on activate/deactivate. Does that sound okay?

@Samwilson - I think we'd be okay with deploying the config change first as well, but would it be possible to do some testing first by enabling on the beta cluster? (cc @ppelberg)

Change 804017 had a related patch set uploaded (by Samwilson; author: Samwilson):

[operations/mediawiki-config@master] [beta cluster] Update $wgVectorMaxWidthOptions to include action=edit

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

Good idea, sorry for not doing that earlier this week! If the above patch looks okay, I'll schedule it for deployment later today.

Change 804017 merged by jenkins-bot:

[operations/mediawiki-config@master] [beta cluster] Update $wgVectorMaxWidthOptions to include action=edit

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

Change 804255 had a related patch set uploaded (by Samwilson; author: Samwilson):

[operations/mediawiki-config@master] [beta cluster] Fix $wgVectorMaxWidthOptions array depth

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

Mentioned in SAL (#wikimedia-operations) [2022-06-09T07:43:09Z] <jnuche@deploy1002> Synchronized wmf-config/CommonSettings-labs.php: Config: [[gerrit:804017|[beta cluster] Update $wgVectorMaxWidthOptions to include action=edit (T307725)]] (duration: 03m 41s)

Change 804255 merged by jenkins-bot:

[operations/mediawiki-config@master] [beta cluster] Fix $wgVectorMaxWidthOptions array depth

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

Mentioned in SAL (#wikimedia-operations) [2022-06-09T07:55:40Z] <jnuche@deploy1002> Synchronized wmf-config/CommonSettings-labs.php: Config: [[gerrit:804255|[beta cluster] Fix $wgVectorMaxWidthOptions array depth (T307725)]] (duration: 03m 40s)

@Samwilson I find that when I open the WikiEditor and then switch to VE, the VE editor is full-width. However, if I go to VE first VE is not full-width.

Opening VE first:

ve_first.png (799×1 px, 107 KB)

Opening WikiEditor first and switching to VE:

ve_second.png (596×1 px, 75 KB)

@Samwilson After clicking "Show Preview" or "Show changes" the WikiEditor is not full-width.

Yep, that's expected at the moment. :-(

There are also problems when VE's editing mode preference is "always visual".

@EAkinloose found this bug on beta. Notice that the image slightly overflows its border on the right:

images_overflow_right.png (413×1 px, 216 KB)

Page: https://en.wikipedia.beta.wmflabs.org/wiki/Cat?veaction=edit

It appears to affect all images. It happens when VE is full-width and not full-width.

@EAkinloose found this bug on beta. Notice that the image slightly overflows its border on the right:

images_overflow_right.png (413×1 px, 216 KB)

Page: https://en.wikipedia.beta.wmflabs.org/wiki/Cat?veaction=edit

It appears to affect all images. It happens when VE is full-width and not full-width.

I filed it here-T310286

This should hopefully be a rare case

The most likely times this'll happen are:

  • Open-in-new-tab the edit link (which I do a lot, honestly)
  • Reloading the page while the editor is open (because the URL is updated)

If we want to find out how common these are, I think we could find it from analytics. There's a specific init type in EditAttemptStep for "launched from direct URL".

@Samwilson - I think we'd be okay with deploying the config change first as well, but would it be possible to do some testing first by enabling on the beta cluster? (cc @ppelberg)

+1 to the suggestion @ovasileva is making about testing on Beta Cluster.

Related: @NRodriguez would it be alright for the Editing Team to assume CommTech will be able to take care of this QA?


More broadly, the Editing Team does NOT think the pilot wiki deployments the CommTech has planned need to be blocked by the issues @Samwilson and @DLynch named in T307725#7987614 and T307725#7992956, which are now captured in T310309.

With the above said, the Editing Team would value the CommTech Team assuming responsibility for the work to resolve T310309.

If we want to find out how common these are, I think we could find it from analytics. There's a specific init type in EditAttemptStep for "launched from direct URL".

That's useful. It's the event.init_mechanism field, right? The recent totals are as follows (I'm not sure why lots don't have any mechanism recorded):

yearmonthno mechanismurlurl-newnewclickTotal (any url*)Total (all)Direct URL percent
202265,239,836430,118168,192301,7431,573,017598,3107,712,9068%
2022518,300,2752,106,648871,3961,074,0225,618,7712,978,04427,971,11211%
2022417,813,7571,560,718743,4451,218,5035,218,9412,304,16326,555,3649%
2022312,423,5601,471,959527,040798,2293,501,7101,998,99918,722,49811%
SELECT
  year, month,
  SUM(if(event.init_mechanism is null, 1, 0)) as none,
  SUM(if(event.init_mechanism = 'url', 1, 0)) as url,
  SUM(if(event.init_mechanism = 'url-new', 1, 0)) as url_new,
  SUM(if(event.init_mechanism = 'new', 1, 0)) as new,
  SUM(if(event.init_mechanism = 'click', 1, 0)) as click,
  COUNT(dt) as total
FROM editattemptstep
group by year, month
order by editattemptstep.year desc, editattemptstep.month desc

The mechanisms are as follows:

click: Editing has been initiated from an edit link
new: Editing has been initiated by clicking on redlink if type=page or new section link if type=section
url: Editing has been initiated by direct navigation.
url-new: Editing has been initiated by direct navigation to a non-existent page if type=page or a new section link if type=section

Related: @NRodriguez would it be alright for the Editing Team to assume CommTech will be able to take care of this QA?

@ppelberg She is on holiday at the moment. I am currently testing this in beta. However, it would be a good idea to get several testers involved in this. For example, because this change could/does impact VE and I don't have any experience testing VE, it might be a good idea to get someone who does. I also don't know if this change might have broader side-affects for the Vector skin. Therefore, I have personally contacted @Ryasmeen, @EAkinloose and @Edtadros.

Test report for beta:

I tested the VisualEditor and 2010 WikiEditor in Vector 2022. I checked the functioning of various menu items and features of the editors.

I also followed the "checklist for VE" document for regression testing VE.

I tested switching between VE and WikiEditor.

I also tested that I could save in VE and WikiEditor.

I changed as many preferences associated with VE and WikiEditor as I could find, but I don't know if I got them all.

I tested editing pages in (almost) all the namespaces on enwiki beta, including code editing (e.g. common.js).

I did most of my testing on https://en.wikipedia.beta.wmflabs.org, but also briefly tested https://en.wikisource.beta.wmflabs.org, https://wikidata.beta.wmflabs.org, https://meta.wikimedia.beta.wmflabs.org and a couple more.

I did most of my testing on Firefox 91, but also briefly tested on Chromium 87 and Safari 14 (emulated).

I briefly tested the 2017 wikitext editor.

I briefly tested editing in Vector Legacy.

I had the browser console open while I was testing and I did not see any JS errors (apart from the usual ones you get on beta).

I also regularly checked beta's logstash and did not see any errors which seemed to me connected with this change.

I didn't test gadgets.

I'm not sure why lots don't have any mechanism recorded

It's because EditAttemptStep has a somewhat painful structure. The rows without an init_mechanism aren't inits, they're other types of event.

Which does mean we need to do this to the data, getting us much higher direct URL percentages:

yearmonthurlurl-newnewclickTotal (any url*)Total (all)Direct URL percent
20226430,118168,192301,7431,573,017598,3102,473,07024%
202252,106,648871,3961,074,0225,618,7712,978,0449,670,83731%
202241,560,718743,4451,218,5035,218,9412,304,1638,741,60726%
202231,471,959527,040798,2293,501,7101,998,9996,298,93832%

So somewhere in the 24-32% range of edits is initialized this way.

@DLynch ah, that makes much more sense, I should've looked deeper. :) Thanks for fixing it up.


I've scheduled the config change (to update $wgVectorMaxWidthOptions to include action=edit) for 2022-07-14 07:00 UTC: https://wikitech.wikimedia.org/w/index.php?title=Deployments&oldid=1988518#Tuesday,_June_14

Change 802685 merged by jenkins-bot:

[operations/mediawiki-config@master] Update $wgVectorMaxWidthOptions to include action=edit

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

Mentioned in SAL (#wikimedia-operations) [2022-06-14T07:16:26Z] <taavi@deploy1002> Synchronized wmf-config/InitialiseSettings.php: Config: [[gerrit:802685|Update $wgVectorMaxWidthOptions to include action=edit (T307725)]] (duration: 03m 36s)

I think this task is complete, and all follow-up work is now captured in other tasks. QA for this can happen on any wiki where RTP is enabled (beta, testwiki, cawiki), but probably viwiki or fawiki are most useful as Vector-2022 is the default on those.

Untagging web team. We'll be following T309882 to track and support the follow up work.

I have briefly tested editing on WikiEditor and VisualEditor on enwiki, fawiki, viwiki and plwiki.

Change 802427 abandoned by Samwilson:

[mediawiki/skins/Vector@master] Add $wgVectorMaxWidthOptions['exclude']['editors'] to avoid max-width in VE

Reason:

Out of date.

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