Problem/Motivation

Prior to #3231334: Global attributes (<* lang> and <* dir="ltr rtl">): validation + support (fix data loss) there were scenarios where:

GHS attributes are not retained in linked media when no additional GHS attributes are allowed on <drupal-media> element.

This would allow retaining data-bar in linked media:
<drupal-media data-foo> <a data-bar>

However, this does not, even though it should:
<a data-bar>

We should add a test to confirm this is in fact addressed.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3276217

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lauriii created an issue. See original summary.

Wim Leers’s picture

lauriii’s picture

Yes, this is unrelated to those. However, I believe this is entirely on our side. This is related to how we are integrating to GHS in DrupalMediaGeneralHtmlSupport.

Wim Leers’s picture

Issue tags: +Needs tests

👍

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lauriii’s picture

Priority: Major » Normal
Status: Active » Needs review
Issue tags: -Needs tests

I don't think there's a way to reproduce this now that #3231334: Global attributes (<* lang> and <* dir="ltr rtl">): validation + support (fix data loss) has been committed because that ensures that when <drupal-media> is enabled, there's always additional attributes added to it via GHS. I added test coverage for this, but on top of that, we may want to harden the code a bit even though there isn't any way to test that now.

Wim Leers’s picture

that ensures that when <drupal-media> is enabled

… only if filter_html is enabled though, right? So for "Full HTML" that won't be the case.

But your test is proving that it works fine for the "Full HTML" use case too. So … what hardening are you thinking of?

(Also reviewed the MR: basically only nits.)

lauriii’s picture

… only if filter_html is enabled though, right? So for "Full HTML" that won't be the case.

But your test is proving that it works fine for the "Full HTML" use case too.
...

I'm not sure this ever was broken for the Full HTML case – I have only tested this in the restricted use case. I also realized that the Full HTML use case wouldn't be solved by that issue, hence the test coverage to ensure that Full HTML case also works as expected.

...
So … what hardening are you thinking of?

If you look at https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/modules/cked..., it's clear that the GHS processing for the link attributes is only added when there is also GHS attributes added for <drupal-media> element. That is wrong, but there isn't any realistic use cases where that would cause issues now that #3231334: Global attributes (<* lang> and <* dir="ltr rtl">): validation + support (fix data loss) is in. 🤷‍♂️

Wim Leers’s picture

Status: Needs review » Needs work

Well then … I don't see what further hardening we would need. Especially now that we have test coverage for this. 👍😄

Will RTBC as soon as the nits are addressed 🥳

lauriii’s picture

Status: Needs work » Needs review
Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

🚢

bnjmnm made their first commit to this issue’s fork.

bnjmnm’s picture

Title: [drupalMedia] GHS attributes are not retained in linked media » [drupalMedia] add tests to confirm GHS attributes are retained in linked media
bnjmnm’s picture

Issue summary: View changes

  • bnjmnm committed a476ccf on 10.0.x
    Issue #3276217 by lauriii, Wim Leers: [drupalMedia] add tests to confirm...

  • bnjmnm committed 0b4483b on 9.5.x
    Issue #3276217 by lauriii, Wim Leers: [drupalMedia] add tests to confirm...

  • bnjmnm committed 818bd67 on 9.3.x
    Issue #3276217 by lauriii, Wim Leers: [drupalMedia] add tests to confirm...

  • bnjmnm committed 6c0d199 on 9.4.x
    Issue #3276217 by lauriii, Wim Leers: [drupalMedia] add tests to confirm...
bnjmnm’s picture

Version: 9.5.x-dev » 9.3.x-dev
Status: Reviewed & tested by the community » Fixed

Test works nicely. Committed to 10.0.x and cherry picked to 9.5.x, 9.4.x, and 9.3.x

Status: Fixed » Closed (fixed)

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