Page MenuHomePhabricator

tables with id "toc" are invisible in VisualEditor but can be (acidentally) deleted
Closed, ResolvedPublic1 Story Points

Description

Some TOC templates include tables with the class "toc", (e.g. {{Deaths in month TOC}} and {{Lists_of_rail_accidents_years}}) either directly or inherited (e.g. from {{TOC top}}). These templates replace the standard TOC when it is unsuitable for some reason, and like the standard TOC get hidden when a page is seen in VE's editing surface. However, although it is not possible to directly interact with them it is possible to accidentally (and unknowingly) delete them or overwrite them with something else. TOC templates that suppress the standard TOC by using the NOTOC magic world (e.g. {{Index into List of UK Baronetcies}}) behave as normal templates.

See also my very crude sandbox test page and edit.

The templates disappearing is clearly not optimal and the inconsistent behaviour equally so. I suggest that either templates including tables with class "toc" do not get hidden and appear as normal templates (first preference) or those templates and those using NOTOC appear instead as something that can be interacted with in the same manner as templates that produce no visible output (e.g. {{Use dmy dates}}). See the top of Deaths in September 2010 for an example of an article with an invisible but interactable-with template and a template that is truly invisible.

Event Timeline

Restricted Application added a project: VisualEditor. · View Herald TranscriptFeb 18 2018, 3:28 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Esanders claimed this task.Feb 20 2018, 3:30 PM
Esanders edited projects, added VisualEditor (Current work); removed VisualEditor.
TheDJ renamed this task from tables with class "toc" are invisible in VisualEditor but can be (acidentally) deleted to tables with id "toc" are invisible in VisualEditor but can be (acidentally) deleted.Feb 20 2018, 4:14 PM
TheDJ updated the task description. (Show Details)
TheDJ added a subscriber: TheDJ.

It's actually the id #toc that these templates use that is the problem:

.ve-activated #toc {
    display:none;
}

Change 412941 had a related patch set uploaded (by Esanders; owner: Esanders):
[mediawiki/extensions/VisualEditor@master] Avoid hiding generated #toc

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

We should use .toc instead of #toc, I deprecated the latter in mw core a while ago.

TheDJ added a comment.EditedFeb 20 2018, 4:27 PM

We should use .toc instead of #toc, I deprecated the latter in mw core a while ago.

All the style definitions in core still use both it seems. Maybe its time to fix that indeed.

[edit] Actually, it seems it's worse. the print style rework started using it to increase the specificity..
// Using #toc rather than .toc to override default print style

Change 412941 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Avoid hiding generated #toc

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

TheDJ added a comment.Feb 20 2018, 5:06 PM

We should use .toc instead of #toc, I deprecated the latter in mw core a while ago.

Core technical debt problem now T187808: Complete switch of toc styling from id #toc to class .toc

Deskana closed this task as Resolved.Feb 21 2018, 12:19 PM
Deskana triaged this task as Normal priority.
Deskana set the point value for this task to 1.