Skip to content

Commit 498fc18

Browse files
chore(ui5-user-menu): acc fixes (#13182)
* chore(user-menu): acc fixes * chore(user-menu): acc fixes * chore(user-menu): acc fixes Fixes: - translatable texts are aligned with spec - 'undefined' announcment is removed - 'Accounts' aria label is now to the list instead of the panel - Menu with Settings items now has corect aria label
1 parent f314795 commit 498fc18

4 files changed

Lines changed: 24 additions & 20 deletions

File tree

packages/fiori/src/UserMenu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ class UserMenu extends UI5Element {
475475
}
476476

477477
getAccountDescriptionText(account: UserMenuAccount) {
478-
return `${account.subtitleText} ${account.description} ${account.selected ? UserMenu.i18nBundle.getText(USER_MENU_POPOVER_ACCESSIBLE_ACCOUNT_SELECTED_TXT) : ""}`;
478+
return `${account.titleText} ${account.subtitleText} ${account.description} ${account.selected ? UserMenu.i18nBundle.getText(USER_MENU_POPOVER_ACCESSIBLE_ACCOUNT_SELECTED_TXT) : ""}`;
479479
}
480480

481481
getAccountByRefId(refId: string) {

packages/fiori/src/UserMenuAccount.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class UserMenuAccount extends UI5Element {
103103
loading = false;
104104

105105
get _initials() {
106-
return this.avatarInitials || "undefined";
106+
return this.avatarInitials || undefined;
107107
}
108108
}
109109

packages/fiori/src/UserMenuTemplate.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default function UserMenuTemplate(this: UserMenu) {
7777
selectionMode="None"
7878
separators="None"
7979
accessibleRole="Menu"
80+
accessibleName={this._ariaLabelledByActions}
8081
onItemClick={this._handleMenuItemClick}
8182
onui5-close-menu={this._handleMenuItemClose}
8283
>
@@ -103,16 +104,18 @@ function headerContent(this: UserMenu) {
103104
return (<>
104105
{this._selectedAccount &&
105106
<div class="ui5-user-menu-selected-account" aria-label={this._ariaLabelledByAccountInformationText}>
106-
<Avatar size="L" onClick={this._handleAvatarClick} initials={this._selectedAccount._initials} colorScheme={this._selectedAccount.avatarColorScheme} fallbackIcon={personPlaceholder} class="ui5-user-menu-selected-account-avatar" interactive>
107-
{this._selectedAccount.avatarSrc &&
108-
<img src={this._selectedAccount.avatarSrc} title={this.showEditButton ? this._editAvatarTooltip : undefined }/>
109-
}
110-
{this.showEditButton &&
111-
<Tag slot="badge" wrappingType="None" design="Set1" colorScheme="5" >
112-
<Icon slot="icon" name={edit}></Icon>
113-
</Tag>
114-
}
115-
</Avatar>
107+
<span title={this.showEditButton ? this._editAvatarTooltip : undefined}>
108+
<Avatar size="L" onClick={this._handleAvatarClick} initials={this._selectedAccount._initials} colorScheme={this._selectedAccount.avatarColorScheme} fallbackIcon={personPlaceholder} class="ui5-user-menu-selected-account-avatar" interactive>
109+
{this._selectedAccount.avatarSrc &&
110+
<img src={this._selectedAccount.avatarSrc}/>
111+
}
112+
{this.showEditButton &&
113+
<Tag slot="badge" wrappingType="None" design="Set1" colorScheme="5" >
114+
<Icon slot="icon" name={edit}></Icon>
115+
</Tag>
116+
}
117+
</Avatar>
118+
</span>
116119
{this._selectedAccount.titleText &&
117120
<Text id="selected-account-title" class="ui5-user-menu-selected-account-title">{this._selectedAccount.titleText}</Text>
118121
}
@@ -137,7 +140,7 @@ function headerContent(this: UserMenu) {
137140

138141
function otherAccountsContent(this: UserMenu) {
139142
return (<>
140-
<Panel collapsed={true} class="ui5-user-menu-other-accounts" aria-label={this._otherAccountsButtonText}>
143+
<Panel collapsed={true} class="ui5-user-menu-other-accounts">
141144
<div slot="header" class="ui5-user-menu-account-header">
142145
<Title slot="header" level="H4" wrapping-type="None">{this._otherAccountsButtonText} ({this._otherAccounts.length})</Title>
143146
{this.showEditAccounts &&
@@ -155,7 +158,8 @@ function otherAccountsContent(this: UserMenu) {
155158

156159
function otherAccountsList(this: UserMenu) {
157160
return (<>
158-
<List onItemClick={this._handleAccountSwitch} aria-label={this._ariaLabelledByActions} loadingDelay={0}
161+
<List onItemClick={this._handleAccountSwitch} loadingDelay={0}
162+
accessibleName={`${this._otherAccountsButtonText} (${this._otherAccounts.length})`}
159163
loading={this._otherAccounts.some(account => account.loading === true)}>
160164
{this._otherAccounts.map((account, index) =>
161165
<ListItemCustom
@@ -164,7 +168,7 @@ function otherAccountsList(this: UserMenu) {
164168
"ariaPosinset": index + 1,
165169
"ariaSetsize": this._otherAccounts.length
166170
}}
167-
aria-label={account.titleText}
171+
accessibleName={this.getAccountDescriptionText(account)}
168172
>
169173
<div class="ui5-user-menu-other-accounts-content">
170174
<Avatar slot="image" size="S" initials={account._initials} fallbackIcon={personPlaceholder} colorScheme={account.avatarColorScheme}>

packages/fiori/src/i18n/messagebundle.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,11 @@ USER_MENU_MANAGE_ACCOUNT_BUTTON_TXT=Manage account
575575
#XTXT: User menu sign out button
576576
USER_MENU_SIGN_OUT_BUTTON_TXT=Sign Out
577577

578-
#XACT: ARIA User menu edit avatar
579-
USER_MENU_EDIT_AVATAR_TXT=Edit avatar
578+
#XACT: ARIA User menu edit profile image
579+
USER_MENU_EDIT_AVATAR_TXT=Edit Profile Image
580580

581-
#XACT: ARIA edit accounts
582-
USER_MENU_EDIT_ACCOUNTS_TXT=Edit accounts
581+
#XACT: ARIA edit account
582+
USER_MENU_EDIT_ACCOUNTS_TXT=Edit account
583583

584584
#XACT: ARIA information for the user menu popover
585585
USER_MENU_POPOVER_ACCESSIBLE_NAME=User menu for
@@ -588,7 +588,7 @@ USER_MENU_POPOVER_ACCESSIBLE_NAME=User menu for
588588
USER_MENU_CLOSE_DIALOG_BUTTON=Decline
589589

590590
#XTXT: ARIA selected account
591-
USER_MENU_POPOVER_ACCESSIBLE_ACCOUNT_SELECTED_TXT=Selected
591+
USER_MENU_POPOVER_ACCESSIBLE_ACCOUNT_SELECTED_TXT=selected
592592

593593
#XTXT: ARIA User menu current account information
594594
USER_MENU_CURRENT_INFORMATION_TXT=Current user information

0 commit comments

Comments
 (0)