[PP-1] 'Restrict images to this site' leads to incorrect HTML with language attribute

Created on 29 September 2014, about 10 years ago
Updated 6 November 2023, about 1 year ago

To mark language changes in body text, editors can use <span lang="nl">Nederlands</span>.
But this get rendered in invalid HTML, where we will find the attribute xml:lang twice. This will fail in validators and fail wcag2.

<p><span dir="rtl" lang="he" xml:lang="he" xml:lang="he">תוכן עניינים</span></p>

Steps to reproduce

- add basic page
- keep text format 'basic HTML'
- change wysiwyg-editor to 'source'
- add <span dir="ltr" lang="fr">vive la vie</span>
- click save and publish
- look in the source HTML (not DOM), you will find:
<span dir="ltr" lang="fr" xml:lang="fr" xml:lang="fr">vive la vie</span>

we would expect:
<span dir="ltr" lang="fr">vive la vie</span>

Background

Basic HTML is using several filters. The problematic filter is 'Restrict images to this site', in combination with 'Correct faulty and chopped off HTML'. As other combinations with 'Correct faulty and chopped off HTML' work, 'Restrict images to this site' is suspicious.

This might be related to the fact that Drupal has no html5 parser ( 🌱 [Meta] PHP DOM (libxml2) misinterprets HTML5 Active ). But even for html4, this result is invalid.

🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component
Filter 

Last updated about 14 hours ago

No maintainer
Created by

🇳🇱Netherlands Hanno

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024