Page MenuHomePhabricator

Add button to "expand all" sections of a page (Mobile view)
Closed, DuplicatePublic


Author: bdarnault

On a smartphone, when viewing a Wikipedia page (Mobile view), add a "Expand all" button at the top of the page which expands all sections of the page.

This will allow an easy text search through the entire page, which is especially useful on a mobile device when trying to navigate to relevant parts of a page.

Note: this can be achieved by switching to Desktop view, but that means loosing the mobile view and it's more friendly formatting.

Version: unspecified
Severity: enhancement
OS: other
Platform: Smartphone



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:34 AM
bzimport set Reference to bz45951.
bzimport added a subscriber: Unknown Object (MLST).

bdarnault wrote:

Note: currently, sections have to be expanded manually one by one before a text search can be performed throughout the page

This is an interesting suggestion. I'd worry about a button at the top of the page however. I wonder if any of the design team can provide some input on how a user might be able to open all sections easily but not in a way that intrudes on users who have no need for it.

I'm pretty sure in javascript we could detect a blur event on the window object and toggle open sections.

$( window ).on( 'blur', function(){ $('h2').click(); } )

pragun06 wrote:

What is the status of this bug as of now? Do we have any more information as to how we want this 'button' to be included?

It's an enhancement so it requires discussion/interest which there seems to have been none of yet (if it exists it should be on this bug report). It's also not necessarily the best solution to the problem of allowing 'find on this page' to work so we should at least consider several other solutions.

  • Bug 49202 has been marked as a duplicate of this bug. ***

Another way to look at this bug is to determine when a user has come from a search engine and in that situation toggle open all sections or even better toggle the section that contains the content and goes to it.

Note google already allows you to jump directly to the section that it found the content (Jump to Climate – San Francisco's climate is characteristic of the cool-summer Mediterranean climate of California's coast, "generally characterized by ...)

It seems that Google provides the Jump to <section> link if the search terms match neatly, after reducing the section title word/phrase down (e.g., de-pluralizing). So, for example, a search for _giraffe subspecies_ will yield a Jump to Subspecies hyperlink, but _giraffe genetics_ won't yield a similar Jump to link. Maybe the trick would be to see if there are no matching sections for the Referer and in that case, if the canonicalized text (e.g., _genetics_ or failing that _giraffe genetics__ which incidentally contains the article title) is present, land the user in the appropriate section?

As a user I would like both the option to Expand All/Collapse All and to be landed in the appropriate section from search for the case where an #anchor isn't already in the document.location. For the former, it's nice to be able to use Find in Page in the case an idea strikes me while and I want to see if there's page text that matches what I'm looking for. For the latter, ending up at the place I intended is really slick.

As pointed out above this is all possible it just needs some design thought. Could we somehow incorporate a in page search into the existing search bar?

It seems right now the main motivation for an expand all / collapse all is to do a find on page operation. Now if we could only bind an event to the find on page browser function ... :( [1]

I found this post on usability issues with collapsed sections in general [2]


Ah, that's a neat idea. The other options may work nicely with this feature, or this feature may be good enough (dev time at a premium, so it's not like all of it can necessarily be built). I think maybe if the <input> area has something like "Search Wikipedia and *NEW!* this page" may do it in time, once users become familiar with it (probably after their first few searches). I wonder if differently shaded snippets plus "...[in this article]" for current page search hits would make sense. Clicks on the searched items could be captured to an event log to see the percentage of same article versus different article clicks.

jgonera wrote:

When I talked to a few people annoyed by collapsed sections, they did not mention find on page specifically. I assume, some people just might want them unfolded all the time. Possibly we could have an option in Settings for this in future.

This is still a commonly requested feature.

Seems to be several ways to surface unfolding all sections:

  • a button somewhere in the page
  • a link (view this page with all sections open)
  • a gesture (e.g. shake) that opens them all
  • a setting in the user preferences/ site settings
  • learning based on behaviour (if a user opens 3 sections in a given period of time open them all)

We should collect some data on this.

Adding a button/link to every page would be UI cruft (especially since doing a full page search on mobile is an edge case). The idea of having a user preference to always expand all sections seems like a good idea though.

The UI implementation in change Ib5ab3af7 isn't bad. For the functional implementation, it should probably be done in Javascript rather than on the PHP side, so we don't have more cache fragmentation.

Is the user option going to make a "[ + ]" (toggles to "[ - ]") button _available_, or is it going to autoexpand every section every time? I can see the pros and cons of either approach, I guess, although I like the concept of the preference being labeled "Show expand/collapse button".

You could also make a case for opening all sections by default.

Would be good to analyse section toggling a bit more to see what is the preferred desired behaviour.

It took me a while to find this bug: I STRONGLY support this feature as full page search on mobile is a very common case for me, and "expand all" with help of the brower's "find in page" function seems like a simple solution. I'd actually prefer the "expand all" button on the top of an article, but I would be happy with a setting as well that automatically expands all articles for me. -- Any ETA?

Thank you so much for your hard work!

Change 74922 had a related patch set uploaded by Pcc:
Add an "always expand all sections" option

Change 74922 merged by jenkins-bot:
Add an "always expand all sections" option

This is now in alpha so we can play with this and make a decision on whether this is the right kind of solution.