Skip to content

Commit

Permalink
refactor: move dom.setAttribute('role', 'img') to reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniciusCestarii committed Jun 21, 2024
1 parent b15b918 commit 64539fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/visual/aria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
return;
}

dom.setAttribute('role', 'img');

if (labelModel.get('description')) {
dom.setAttribute('role', 'img');
dom.setAttribute('aria-label', labelModel.get('description'));
return;
}
Expand Down Expand Up @@ -242,7 +243,6 @@ export default function ariaVisual(ecModel: GlobalModel, api: ExtensionAPI) {
const endSeparator = separatorModel.get('end');
ariaLabel += seriesLabels.join(middleSeparator) + endSeparator;

dom.setAttribute('role', 'img');
dom.setAttribute('aria-label', ariaLabel);
}
}
Expand Down

0 comments on commit 64539fe

Please sign in to comment.