Page MenuHomePhabricator

Table of contents' hidden state isn't kept after reload
Open, Needs TriagePublic

Description

There are at least two reports in ruwiki that the table of contents' hidden state isn't kept after page reload (I confirm). This could be connected to T195053. This is not wiki-dependent, not user-dependent, and it doesn't look like it's browser-dependent (in Firefox, the state is kept only when you press "Refresh", and that's probably some browser feature).

Steps to reproduce:

  1. Open any wiki page with more than 3 sections, for example https://en.wikipedia.org/wiki/Phabricator.
  2. Click [hide] in TOC.
  3. Refresh the page (in Firefox, click in the address bar and press "Enter").

Expected result:
TOC is hidden.

Actual result:
TOC is shown.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 29 2018, 9:21 PM
Jack_who_built_the_house updated the task description. (Show Details)
Jack_who_built_the_house updated the task description. (Show Details)
Jack_who_built_the_house updated the task description. (Show Details)
SerDIDG added a subscriber: SerDIDG.
Jack_who_built_the_house renamed this task from Table of contents' hidden state isn't kept after reload in Chrome to Table of contents' hidden state isn't kept after reload.Nov 29 2018, 11:10 PM
Jack_who_built_the_house updated the task description. (Show Details)
Jack_who_built_the_house updated the task description. (Show Details)

Quote from https://gerrit.wikimedia.org/r/372515: "Changes in the behavior: [...] The state of the button is not saved in a cookie."

@Schnark So, what is it based on? Technical unfeasibility? Perceived lack of necessity? There are users who are not happy about it. I think, some would say, there is no need in the hiding/showing functionality at all if the state is not saved in a cookie. The only thing it does when used on one page is saves a small amount of space.

Schnark added a subscriber: Fomafix.Dec 1 2018, 8:42 AM

Don't know, let's ask @Fomafix.

It is possible to reimplement the former behavior and store the status in a cookie on a change. Restoring the status from a cookie with JavaScript can only be done after DOM ready and this leads to a flash of the full ToC before it get minimized. A way to avoid this is to hide the ToC already on server-side. With a cookie this would also be possible but cookies are unwanted for such a think. An alternative is to store the status in a user option. Anonymous user have no user options and therefor they can not store the status in the user options. An advantage of storing in user options is that the status is shared for browser the user uses.

Fomafix claimed this task.Feb 14 2019, 9:25 PM

Change 490705 had a related patch set uploaded (by Fomafix; owner: Fomafix):
[mediawiki/core@master] ToC: Save and restore the state of the toc toggle in a cookie

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