Page MenuHomePhabricator

[ToC] Enumeration of sections in the new ToC (numbers for ToC items)
Open, Needs TriagePublicFeature

Assigned To
None
Authored By
Nux
May 1 2022, 10:33 PM
Referenced Files
F35120931: obraz.png
May 9 2022, 5:06 PM
F35120946: obraz.png
May 9 2022, 5:06 PM
F35087137: obraz.png
May 1 2022, 10:33 PM
Subscribers
Tokens
"Love" token, awarded by Jules78120.

Description

Feature summary (what you would like to be able to do and where):

Add enumeration for the new ToC.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

A few users on Polish Wikipedia discord asked for this. They asked for enumeration specifically (like in the old ToC).

Benefits (why should this be implemented?):

I think this would make sections more obvious (where each item starts and ends). Currently its more like a wall of text.

Levels would be more obvious as well. Especially after T306562 which changes all of the items to the same color.

Prototype
Example article: https://pl.wikipedia.org/wiki/Jerzy_Skolimowski

Screen:

obraz.png (1×1 px, 332 KB)

Stylus export:
(note that you will need to adjust for change in T306562; especially font-size)

@-moz-document domain("pl.wikipedia.org") {
#mw-panel-toc ul {
    /* reset at the start of each level */
    counter-reset: tocsection;
    list-style-type: none;
}
#mw-panel-toc li::before {
    counter-increment: tocsection;
    /* combine values of each level with a period */
    content: counters(tocsection, ".") ". ";
    
    float: left;
    font-size: 0.875em;
    display: block;
    padding-top: 4px;
    padding-right: .3em;
}

/* modify first link (top link) */
/*
#mw-panel-toc > ul {
    counter-reset: tocsection -1;
}
*/
#mw-panel-toc > ul > li:first-of-type::before {
    display:none;
}

/* colors */
#mw-panel-toc ul a {
    color: #0645ad;
}

/* adjust widths */
.sidebar-toc {
    /* width: 15.25em; */
    width: 19.25em;
}
.mw-page-container {
    /* max-width: 94.625em; */
    max-width: 98.625em;
}

}

Event Timeline

The preference was removed in T284921: Remove "auto-number headings" preference (see the previous discussion and reasoning) and there don't seem to be new and different arguments in this ticket. Declining.

This is not the same. T284921 says:

The "auto-number headings" controls whether section numbers are shown in section headings. The default behavior is to show numbering in the table of contents, but not in the actual section headings.
Solution:
If there is no great demand for this feature, we should simply remove it. If the feature is to be kept, it should be implemented in CSS: the numbering would always be generated, but the browser would be instructed to not display them. Appropriate CSS rules for showing the numbers could easily be generated from the user settings on the fly. Numbering in ToC would remain

Also note that ToC is enumerated in legacy vector. When you create a new account you get this view:

obraz.png (835×397 px, 52 KB)

But with new vector and new ToC enumeration is gone. Not just from headings. From the ToC itself, not from headings.

obraz.png (345×244 px, 8 KB)

Also note that T284921 talks about numbers in HTML and a lot of users says that probably the numbers should be kept for headers but implemented with CSS.

Fairly similar CSS code can be used both for ToC (current function) and headers (old function).