Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITES-10923 role="img" is used on decorative images #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions coral-component-icon/src/scripts/Icon.js
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions coral-component-icon/src/tests/test.Icon.js
Expand Up @@ -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());

Expand Down