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

fix(Accessibility) Image Missing Alt Text #342

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
8 changes: 7 additions & 1 deletion coral-component-shell/src/scripts/ShellMenuBarItem.js
Expand Up @@ -384,7 +384,7 @@ class ShellMenuBarItem extends BaseComponent(HTMLElement) {
// providing aria-label will correctly pass it on to the shell menu button child element.
if (name === 'aria-label') {
if (value && this._elements.shellMenuButton.textContent.trim() === '') {
this._elements.shellMenuButton.setAttribute('aria-label', value);
this._elements.shellMenuButton.setAttribute('aria-label', this.title ? this.title : value);
}
} else {
super.attributeChangedCallback(name, oldValue, value);
Expand Down Expand Up @@ -418,6 +418,12 @@ class ShellMenuBarItem extends BaseComponent(HTMLElement) {
if (this.menu !== null) {
this.menu = this.menu;
}

let shellMenuButtonIcon = this._elements.shellMenuButton.getElementsByTagName('coral-icon')[0];

if(shellMenuButtonIcon) {
shellMenuButtonIcon.setAttribute('alt', this.title);
}
}

/**
Expand Down