Page MenuHomePhabricator

Collapsible elements are invisible to browser search
Closed, ResolvedPublicBUG REPORT

Description

Steps to reproduce

  1. Open https://www.mediawiki.org/w/index.php?title=Manual:Collapsible_elements&oldid=5581603
  2. Using the browser search (+F, +F etc.), search for is hidden.

Actual result

  1. Two results are found, in the two code examples.

Expected result

  1. Four results are found: two in the code examples, and two in the rendered examples.

Other information

At least in Chrome and many Chromium-based browsers, MobileFrontend fixed this in 1abe4bd7dbd3b4001979a9bdb518f8d4d287a485 (T216789). The same fix should work here as well.

Keywords for searchability: collapse, collapsibility, template


Browsers supporting this feature: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/hidden#browser_compatibility

  • Chrome since 102 (and Chromium-based browsers), released in 2022
  • Firefox since 139, released in May 2025

Event Timeline

Change 967556 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] makeCollapsible: Expand when text is matched with browser find feature

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

Unfortunately this won't work with how we current collapse tables, as content-visibility can't be used to hide table structure, but it will work in all other cases.

Unfortunately this won't work with how we current collapse tables, as content-visibility can't be used to hide table structure, but it will work in all other cases.

I realised we can force this to work with table cells, by turning them into not-table cells when hidden (using display:block)!

matmarex updated the task description. (Show Details)

Change #967556 merged by jenkins-bot:

[mediawiki/core@master] makeCollapsible: Expand when text is matched with browser find feature

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

@Esanders, probably instead of the specific fix for .wikitable.mw-collapsed, there should be a wider fix for .mw-collapsed [ hidden='until-found' ]. In Russian Wikipedia, we have already found a case with a visible border around a hidden element. I believe there are similar issues in every wiki project.

Change #1166234 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] jquery.makeCollapsible: Avoid extra borders etc. on un-rendered elements

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

@putnik Could you please link some examples, so that we can make sure that this patch will work for them?

Test wiki created on Patch demo by Matma Rex using patch(es) linked to this task:
https://patchdemo.wmcloud.org/wikis/4494d98855/w/

Change #1166234 merged by jenkins-bot:

[mediawiki/core@master] jquery.makeCollapsible: Avoid extra borders etc. on un-rendered elements

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