Commit 68b338b1 authored by Ben Mullins's avatar Ben Mullins
Browse files

Issue #3248440 by lauriii, Wim Leers, nod_: [drupalMedia] Media embed...

Issue #3248440 by lauriii, Wim Leers, nod_: [drupalMedia] Media embed attributes are rendered in container div in editing view
parent f23fbd69
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+6 −2
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ export default class DrupalMediaEditing extends Plugin {

    // Set attributeToAttribute conversion for all supported attributes.
    Object.keys(this.attrs).forEach((modelKey) => {
      conversion.attributeToAttribute({
      const attributeMapping = {
        model: {
          key: modelKey,
          name: 'drupalMedia',
@@ -257,7 +257,11 @@ export default class DrupalMediaEditing extends Plugin {
          name: 'drupal-media',
          key: this.attrs[modelKey],
        },
      });
      };
      // Attributes should be rendered only in dataDowncast to avoid having
      // unfiltered data-attributes on the Drupal Media widget.
      conversion.for('dataDowncast').attributeToAttribute(attributeMapping);
      conversion.for('upcast').attributeToAttribute(attributeMapping);
    });
  }

+3 −0
Original line number Diff line number Diff line
@@ -347,6 +347,9 @@ public function testAlt() {
    // Assert that the img within the media embed within the CKEditor contains
    // the overridden alt text set in the dialog.
    $this->assertNotEmpty($assert_session->waitForElementVisible('css', '.ck-widget.drupal-media img[alt*="' . $who_is_zartan . '"]'));
    // Ensure that the Drupal Media widget doesn't have alt attribute.
    // @see https://www.drupal.org/project/drupal/issues/3248440
    $assert_session->elementNotExists('css', '.ck-widget.drupal-media[alt]');
    // Test `aria-label` attribute appears on the widget wrapper.
    $assert_session->elementExists('css', '.ck-widget.drupal-media [aria-label="Screaming hairy armadillo"]');