Problem/Motivation

Until #2982322: Mark missing embedded entities in WYSIWYG landed, embeds of missing entities ( were deleted) would result in a broken situation for both the content author and the content consumer.

In #2982322, some UI strings were introduced.

Over at #2940029-40: Add an input filter to display embedded Media entities, Drupal core accessibility maintainer @andrewmacpherson pointed out some accessibility concerns:

+  protected function renderMissingMedia() {
+    return [
+      '#type' => 'html_tag',
+      '#tag' => 'img',
+      '#attributes' => [
+        'src' => file_url_transform_relative(file_create_url('core/modules/media/images/icons/no-thumbnail.png')),
+        'width' => 180,
+        'height' => 180,
+        'alt' => $this->t('Deleted content encountered, site owner alerted.'),

Is this text alternative going to be presented publicly to a website visitor? The message here describes the inner working of the CMS, and governance process in the organization who runs it. A public visitor doesn't benefit from being told about this. In any case, "site owner alerted" is not conveyed by the image itself; we don't want to provide extra information to screen reader users which we haven't provided for a sighted user. Also "deleted" isn't the same as "missing".

This is a tricky situation to come up with alt text for. I'd suggest something simpler, like "missing image" or "broken image". This would be a more matter-of-fact statement, which doesn't say anything about the CMS or owner's processes. It would be good to tailor it to the media type ("image" or "video" instead of vague "content").

Proposed resolution

Implement Andrew's suggestions, because that'll improve the experience for everyone.

Remaining tasks

User interface changes

Improved alt and title attributes.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

Status: Active » Needs review
FileSize
2.17 KB
oknate’s picture

What about this part?

It would be good to tailor it to the media type ("image" or "video" instead of vague "content").

Oh never mind. I see you did that. I was looking at the test where it says deleted content.

Could we get a non content example in the test?

Wim Leers’s picture

Could we get a non content example in the test?

I was gonna do that next. If you want to, you can do that instead :) I suggest user, since that entity type is already installed.

oknate’s picture

I can tonight, I’m away from my computer now. Unless you want to.

Wim Leers’s picture

Done.

oknate’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
20.41 KB

RTBC, I don't see any issues.

missing image

  • Wim Leers committed 4f932c5 on 8.x-1.x
    Issue #3063705 by Wim Leers, oknate: Improve `alt` and `title`...
Wim Leers’s picture

Status: Reviewed & tested by the community » Fixed

🚢

Wim Leers’s picture

Ugh, I just realized I didn't credit @andrewmacpherson after creating this issue! 😞 So now he's not in the commit message. But I can still at least give him issue credit. Sorry, Andrew, and thanks again! 🙏

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.