Page MenuHomePhabricator

Add HTML 5 semantic elements 'details' and 'summary' to Sanitizer whitelist
Open, LowestPublic


The HTML5 elements <details> and <summary> (used for making expandable content) are not being allowed by Mediawiki. (This might be only on Wikimedia wikis.)


Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:28 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz29118.
bzimport added a subscriber: Unknown Object (MLST).

Updated bug summary & fields to clarify this is an enhancement request for supporting HTML 5 draft elements in wiki body text:

These would presumably be nice ways to implement various sorts of hidable sections, though user-agent support is likely to be lacking or inconsistent at this stage.

I would not recommend adding any explicit support at this stage, but it should be taken a look at some day.

Going to resolve this as LATER; when UA support is more consistent reopen w/ current info. (The things we do use like <video> are easier to detect and define, and don't duplicate behavior we already deal with w/ JavaScript and some standard class names.)

Many wikis have methods of creating expandable content using javascript which could be replaced by details/summary for browsers that support it. What would be the downsides of having those only use the javascript method for browsers that don't support <details> and <summary>?

Note: <details> and <summary> is supported in Google Chrome.

It is now 2018. Is acceptable user agent support?

(Was thinking about en.wiktionary's frequent use of [show]/[hide]...)

Suzukaze-c added a subscriber: brion.

It is now 2020. Reopening per the second comment by @brion.

Neat! We should probably confirm the behavior is consistent, predictable, and either falls back cleanly or can be emulated sanely (eg in IE 11 if it doesn't support it). Also double check that neither tag is used as an extension. Then I probably have no further objection. :)

From caniuse it looks like IE and old Edge are the holdouts (new Chromium based edge supports it, as well as reasonably current versions of other browsers)

I'm experimenting with this locally to see if we can replace mw-collapsible, polyfilling for IE11 and retaining the majority of the functionality for divs (while dropping tables and lists).

Change 679967 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/core@master] Add HTML5 details and summary to Sanitizer