Topic on Project:Support desk

[Bug] "bdi" element recursive encapsulation

3
Summary by Star Warden

Reported to phabricator.

Verdy p (talkcontribs)

MediaWiki accepts the HTML tag "bdi", but fails to parse it correctly when it contains another "bdi" element.

The following is perfectly valid in standard HTML :

Some outer text "<bdi> sub element in Arabic <bdi>English pagename</bdi> back to Arabic.</bdi>" return to outer text.

But in Mediawiki, the inner "bdi" element start and end tags become untranslated (the remaining HTML or MediaWiki syntax is still parsed correctly for their inner content) and the two start and end tags are themselves rendered as plain-text (including their attributes), as if their inclusion was no longer recognized as valid.

This is a bug (that affects various templates, notably those used generating autotranslated contents).

An alternative is to use a much more complex syntax, by replacing "bdi" by "span" with custom or mofied CSS attributes (to add the "unicode-bidi:isolate" style property): this is very lengthy, but the other problem is that older browsers still support the standard "bdi" but not these CSS attributes which have instead several browser-specific variants (with prefixes): tracing all the use cases where we unnecessarily need to add additional browser-specific styles is tedious.

In addition the interest of "bdi" is that it has a *mixed* content, meaning that it is suitable for including either inline elements (text, span, images, br, ref...) and block elements (div, p, lists, tables, references...), but this is not possible if we replace "bdi" by a "span" (it will not work to include block elements) or by a "div" (it will not work to include inline elements, causing line-breaks).

Please fix "bdi" support in MediaWiki to support correct recursive encapsulation of "bdi" elements (just like you accept recursive encapsulations of "span" or "div" or wikitables/HTML tables): it will greatly simplify internationalization and translation templates and will avoid quirks, notably those seen in the "Translate" extension which signals missing translations using an incorrect "div" with light-red background, instead of using a "bdi" as it should (where those missing translations cause severe layout problems and will block many translated pages that are partially translated or contain fuzzy translations).

See also

2002:43F4:3186:1234:AC17:F0AD:B268:244D (talkcontribs)
Verdy p (talkcontribs)