Page MenuHomePhabricator

Parser does not permit nested <kbd> tags.
Closed, ResolvedPublic

Description

When you nest a HTML <kbd> inside another <kbd> MediaWiki parses it incorrectly and outputs one <kbd> element and escaped &lt;kbd&gt; tags.

ie: The input <kbd><kbd>...</kbd></kbd>
incorrectly becomes: <kbd>&lt;kbd&gt;...</kbd>&lt;/kbd&gt;

This is very important because HTML5 says this about the <kbd> element:

When the kbd element is nested inside a samp element, it represents the input as it was echoed by the system.

When the kbd element contains a samp element, it represents input based on system output, for example invoking a menu item.

When the kbd element is nested inside another kbd element, it represents an actual key or other single unit of input as appropriate for the input mechanism.

In other words this is valid html:
<kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd>

Which semantically means user input with the nested <kbd> elements identifying individual keypresses.

Note that if you have tidy enabled the bug does not show up.


Version: unspecified
Severity: normal

Details

Reference
bz41545

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:55 AM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz41545.
bzimport added a subscriber: Unknown Object (MLST).

https://gerrit.wikimedia.org/r/30775 (Gerrit Change I6ad64e6eb4c9b5bdc15be513f55c58f6717c3939) | change APPROVED and MERGED [by jenkins-bot]

This seems to have landed months ago, and seems to work at https://www.mediawiki.org/wiki/Bug41545

Resolving as fixed.