Follow up to T289723. When clicking the edit icons in the new sticky header, the entire page is reloaded. This defeats the point of the sticky header in some ways as it loses the editor's position in the document which might be the reason for clicking the edit icon.
A patch was proposed in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/726694 thinking this might be straightforward, but Bartosz pointed out it wouldn't be, having this to say:
I support doing this, but it will take more work than this to work well. I have two points:
- There are a few complicated behaviors to the edit tabs that this doesn't handle.
Most importantly, we need to make sure that the sticky header icon won't open VE when it's disabled in user preferences, lest someone go for our heads again. [see inline]
Furthermore, we need to implement/test the following: (I didn't test it all with this patch, but it doesn't look like you're handling most of it)
- single edit tab (extra tricky stuff: permanently switching to the other mode if the user switches the mode in the editor; behavior of the single tab when VE is disabled but 2017WTE is enabled)
- 2017 wikitext editor
- DiscussionTools (trying to open VE/2017WTE while reply tool is opened should warn first, instead of losing your input)
Also, if you click the sticky header icon while scrolled down, the page jumps to the top after the editor loads; it should stay (approximately) in the same place. (Somewhat related old feature request: T54577.)
- The above will be a lot of work. If you're investing effort into that already, I wonder if it could be done in such a way as to also support other ways of opening the editor, instead of just the Vector sticky header. We did something similar in DiscussionTools, where we intercept all action=edit links on the page (including those added by gadgets, or within the wikitext of the page). For the editor, this would support things like the "Edit page visually" button on https://en.wikipedia.org/wiki/Wikipedia:Sandbox, or the links added by gadgets that add a section 0 edit link or those that copy article tabs to the bottom of the page.
I haven't had a chance to read through this feedback, but detecting the phrase "a lot of work" figured that this likely deserves a task of its own, and some further analysis/discussion.