Page MenuHomePhabricator

Three slugs in every header/footer on Wikisource VisualEditor, two of them don't work (cause an exception)
Closed, ResolvedPublic

Description

There are three slugs in every header or footer on Wikisource VisualEditor, and the latter two of them don't work (cause an exception when clicked).

For example: https://pl.wikisource.org/w/index.php?title=Strona:O_ontologicznej_beznadziejności_logiki,_fizykalizmu_i_pseudo-naukowego_monizmu_wogóle.djvu/7&veaction=edit

Untitled.gif (1,398×473 px, 91 KB)

Uncaught TypeError: Cannot read property 'getModel' of undefined
    at Object.ve.ce.getOffsetOfSlug (load.php?debug=false&lang=pl&modules=ext.CodeMirror.lib|ext.visualEditor.core&skin=vector&version=1eaib6o:593)
    at VeCeSurface.ve.ce.Surface.createSlug (load.php?debug=false&lang=pl&modules=ext.CodeMirror.lib|ext.visualEditor.core&skin=vector&version=1eaib6o:712)
    at VeCeMwPagesSectionNode.ve.ce.BranchNode.onSlugClick (load.php?debug=false&lang=pl&modules=ext.CodeMirror.lib|ext.visualEditor.core&skin=vector&version=1eaib6o:624)
    at NoFocusButtonWidget.oo.EventEmitter.emit (<anonymous>:246:486)
    at NoFocusButtonWidget.OO.ui.mixin.ButtonElement.onClick (load.php?debug=false&lang=pl&modules=oojs-ui-core&skin=vector&version=1tuzbg3:25)
    at HTMLAnchorElement.dispatch (load.php?debug=false&lang=pl&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1j8y1b9:69)
    at HTMLAnchorElement.elemData.handle (load.php?debug=false&lang=pl&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1j8y1b9:66)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It appears that there are three slugs because we try to insert them between every pair of nodes (except before the page quality selector, which is explicitly disallowed), and there are invisible meta nodes there (mwAlienMeta) corresponding to the <noinclude> and </noinclude> wikitext tags.

image.png (552×234 px, 26 KB)

And they do not work before the meta nodes have no rendering (duh), and ve.ce.Surface.prototype.createSlug apparently only works if the slug is preceded by a node rendering.

This was probably caused by T56299 (before that, there was no meta nodes).

Actually, the real problem here is that the mwAlienMeta nodes are inside the sections, rather than outside. We do not want to allow inserting anything between the mwAlienMeta and beginning/end of section (since that content would end up outside <noinclude></noinclude> in wikitext).

Meta item really shouldn't trigger slugs. Pinging @dchan .

Change 440391 had a related patch set uploaded (by Divec; owner: Divec):
[VisualEditor/VisualEditor@master] Don't put slugs after meta items

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

@Esanders : yes, that seems to solve the issue, both in my local testing and when I monkey patch the live pl.wikisource.org page above.

Change 440391 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Ignore meta items when computing slug positions

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

Note for testing – similar issue also occurs in Wikipedia articles, with a block of non-functional slugs appearing at the end (they are inserted between the invisible category links).

image.png (1,398×980 px, 172 KB)

Change 441184 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (e72749663)

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

Change 441184 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (e72749663)

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

• Deskana triaged this task as Low priority.
• Vvjjkkii renamed this task from Three slugs in every header/footer on Wikisource VisualEditor, two of them don't work (cause an exception) to a9aaaaaaaa.Jul 1 2018, 1:04 AM
• Vvjjkkii reopened this task as Open.
• Vvjjkkii removed • matmarex as the assignee of this task.
• Vvjjkkii raised the priority of this task from Low to High.
• Vvjjkkii updated the task description. (Show Details)
• Vvjjkkii removed subscribers: gerritbot, Aklapper.
Bodhisattwa renamed this task from a9aaaaaaaa to Three slugs in every header/footer on Wikisource VisualEditor, two of them don't work (cause an exception).Jul 1 2018, 3:09 PM
Bodhisattwa closed this task as Resolved.
Bodhisattwa assigned this task to • matmarex.
Bodhisattwa lowered the priority of this task from High to Low.
Bodhisattwa updated the task description. (Show Details)
Bodhisattwa added subscribers: gerritbot, Aklapper.