[drupalImage] Decorative image toggle doesn't add empty alt

Created on 14 February 2024, 8 months ago
Updated 29 February 2024, 7 months ago

Problem/Motivation

According to https://www.w3.org/WAI/tutorials/images/decorative/ when using a decorative image an empty alt tag should be added but currently does not happen.

Steps to reproduce

Within a ckeditor that has the image upload button
Upload an image
Mark it decorative
Save page
Verify image does not have alt tag

Proposed resolution

Add an empty alt tag

Remaining tasks

Agree on solution
Add test coverage
Review

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

🐛 Bug report
Status

Postponed: needs info

Version

11.0 🔥

Component
CKEditor 5 

Last updated about 8 hours ago

Created by

🇺🇸United States smustgrave

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @smustgrave
  • Status changed to Postponed: needs info 7 months ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    There's explicit test coverage in HEAD to ensure this works correctly for decorative images

        // Ensure that the decorative image downcasts into empty alt attribute.
        $editor_dom = $this->getEditorDataAsDom();
        $decorative_img = $editor_dom->getElementsByTagName('img')->item(0);
        $this->assertTrue($decorative_img->hasAttribute('alt'));
        $this->assertEmpty($decorative_img->getAttribute('alt'));
    

    (Added in #3222756: Allow using images from external source .)

Production build 0.71.5 2024