Page MenuHomePhabricator

Allow <details> and <summary> tags
Closed, DuplicatePublicFeature

Description

Feature summary: Wikimedia allows a small set of HTML tags and attributes to be included in wikitext. This feature proposes adding the <details> and <summary> tags as well as the "open" attribute, as written here.

Use case(s): I want to use browser-native collapsible text fields.

Benefits (why should this be implemented?): Currently, collapsible text areas can only be created with Javascript, such as the mw-collapsible class & related JQuery module. HTML includes a <details> tag that is intended for native browser support of collapsible text areas. Supporting <details> would enable wikis to provide even more functionality for users without Javascript. <details> also has a few advantages over jQuery:

  • No "flash of unstyled content" for users with slow browsers
  • Collapsed text is fully searchable
  • <details> can be styled like any other html construct

It should also be relatively safe to introduce the <details> tag. It does not involve any support, and there are no known vulnerabilities with it. <details> is widely supported among modern browsers (since 2011 in Chrome, 2016 in Firefox, and 2012 in Safari).

Introducing <details> should be a simple task. The sanitizer php file will need to be edited to add details as an allowed tag, and allow <summary> as a nestable tag.