Commit 68b338b1 authored by bnjmnm's avatar bnjmnm
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
......@@ -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);
});
}
......
......@@ -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"]');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment