Problem/Motivation

Iframe elements need a title attribute for accessibility.
Currently this module doesn't provide any kind of title attribute. It's not very easy to use for example, the media entity name as the title because the template doesn't know about it.

Steps to reproduce

Just use the module and inspect the iframe element generated by this module and you'll notice there is no title attribute.

Proposed resolution

* Let the template know about the media entity name and try to use it as a title.
* Provide a default value if the title is empty (for some reason).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hartsak created an issue. See original summary.

hartsak’s picture

Status: Active » Needs review
StatusFileSize
new3.78 KB

Here's a simple patch for starters. Trying to use the media entity label for the title and providing a default value "Video" (translatable).
Also, noticed some problems in tests (unrelated) and tried to fix them too.

kekkis’s picture

Thanks for posting the issue! I happen to know of a solution that is already in use: https://github.com/Tampere/tampere-fi/blob/main/patches/media_entity_dre...

We could combine these approaches maybe?

kekkis’s picture

Version: 2.1.0 » 2.1.x-dev
hartsak’s picture

Status: Needs review » Needs work

Oh, you were fast! Nice that you have taken into account the translations too, I completely forgot about them.
I can test your approach too and provide a new patch.

hartsak’s picture

Status: Needs work » Needs review
StatusFileSize
new3.57 KB

Ok, here's another try. I tried to combine your patch with mine. Hopefully I didn't mess up something there...

And by the way, how to use the latest version in tests? Now it seems only "media_entity_dreambroker 8.x-1.x-dev" is available in the "Test with" drop-down?

kekkis’s picture

Thanks for the patch. The testing configuration is not up to date in this project, we should add a gitlab setup to get access to testing again.

kekkis’s picture

I tried adding test support using Gitlab CI in #3481075 but seems I ran out of competence and/or time. Will need to dive deeper into that at some point.

However, I would like to propose that we merge this and release it as part of the 2.1.1 release which is also going to introduce basic Drupal 11 support, albeit not for the tests.

Opinions for or against?

hartsak’s picture

I haven't had any issues with the patch from #6, so I'm not against committing it to the module!
If it was officially committed to the module I wouldn't have to be using the patch.

kekkis’s picture

Status: Needs review » Reviewed & tested by the community
kekkis’s picture

  • kekkis committed 46d9fca4 on 2.1.x authored by hartsak
    Issue #3415554 by hartsak, kekkis: Accessibility: Add title attribute...
kekkis’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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