From 075bc9b283c46a2ca9ff0db00619de44d866b42f Mon Sep 17 00:00:00 2001 From: ens13533 Date: Fri, 16 Feb 2024 13:27:54 +0200 Subject: [PATCH] SITES-10923 removed role img and the test for it --- coral-component-icon/src/scripts/Icon.js | 4 ++-- coral-component-icon/src/tests/test.Icon.js | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/coral-component-icon/src/scripts/Icon.js b/coral-component-icon/src/scripts/Icon.js index bb29a8d7fc..a45adbddd5 100644 --- a/coral-component-icon/src/scripts/Icon.js +++ b/coral-component-icon/src/scripts/Icon.js @@ -413,8 +413,8 @@ const Icon = Decorator(class extends BaseComponent(HTMLElement) { // role depending on whether or not the icon is an arbitrary image URL. const role = this.getAttribute('role'); const roleOverride = role && (role !== 'presentation' && role !== 'img'); - if (!roleOverride) { - this.setAttribute('role', isImage ? 'presentation' : 'img'); + if (!roleOverride && isImage) { + this.setAttribute('role', 'presentation'); } // Set accessibility attributes accordingly diff --git a/coral-component-icon/src/tests/test.Icon.js b/coral-component-icon/src/tests/test.Icon.js index 99bdd0c2c8..421e738aa2 100644 --- a/coral-component-icon/src/tests/test.Icon.js +++ b/coral-component-icon/src/tests/test.Icon.js @@ -436,15 +436,6 @@ describe('Icon', function () { expect(icon.hasAttribute('aria-label')).to.be.false; }); - it('should have role="img" when icon property is not a URL', function () { - var icon = helpers.build(new Icon()); - - icon.icon = 'add'; - icon.alt = 'Add Item'; - - expect(icon.getAttribute('role')).to.equal('img'); - }); - it('should have role="presentation" when icon property is a URL', function () { var icon = helpers.build(new Icon());