Skip to content

feat(ui5-shellbar): add branding area accessibility attributes #11238

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

Merged
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/fiori/src/ShellBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ type ShellBarLogoAccessibilityAttributes = {
}
type ShellBarProfileAccessibilityAttributes = Pick<AccessibilityAttributes, "name" | "expanded" | "hasPopup">;
type ShellBarAreaAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup" | "expanded">;
type ShellBarBrandingAccessibilityAttributes = Pick<AccessibilityAttributes, "name">;
type ShellBarAccessibilityAttributes = {
logo?: ShellBarLogoAccessibilityAttributes
notifications?: ShellBarAreaAccessibilityAttributes
profile?: ShellBarProfileAccessibilityAttributes,
product?: ShellBarAreaAccessibilityAttributes
search?: ShellBarAreaAccessibilityAttributes
overflow?: ShellBarAreaAccessibilityAttributes
branding?: ShellBarBrandingAccessibilityAttributes
};

type ShellBarNotificationsClickEventDetail = {
Expand Down Expand Up @@ -377,6 +379,7 @@ class ShellBar extends UI5Element {
* - **product** - `product.expanded` and `product.hasPopup`.
* - **search** - `search.hasPopup`.
* - **overflow** - `overflow.expanded` and `overflow.hasPopup`.
* - **branding** - `branding.name`.
*
* The accessibility attributes support the following values:
*
Expand Down Expand Up @@ -1499,6 +1502,10 @@ class ShellBar extends UI5Element {
return ShellBar.i18nBundle.getText(SHELLBAR_OVERFLOW);
}

get _brandingText() {
return this.accessibilityAttributes.branding?.name || this.primaryTitle;
}

get hasContentItems() {
return this.contentItems.length > 0;
}
Expand Down Expand Up @@ -1598,6 +1605,12 @@ class ShellBar extends UI5Element {
expanded: overflowExpanded === undefined ? this._overflowPopoverExpanded : overflowExpanded,
},
},
branding: {
"title": this._brandingText,
"accessibilityAttributes": {
name: this.accessibilityAttributes.branding?.name,
},
},
};
}

Expand Down
3 changes: 2 additions & 1 deletion packages/fiori/src/ShellBarTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default function ShellBarTemplate(this: ShellBar) {
onClick={this._headerPress}
aria-haspopup="menu"
aria-expanded={this._menuPopoverExpanded}
aria-label={this._brandingText}
data-ui5-stable="menu"
tabIndex={0}>
{this.showLogoInMenuButton && (
Expand Down Expand Up @@ -290,7 +291,7 @@ function combinedLogo(this: ShellBar) {
tabIndex={0}
onKeyDown={this._logoKeydown}
onKeyUp={this._logoKeyup}
aria-label={this._logoAreaText}>
aria-label={this.accessibilityAttributes.branding?.name || this._logoAreaText}>
{this.hasLogo && (
<span
class="ui5-shellbar-logo"
Expand Down