Skip to content

Commit 35799e8

Browse files
STCOR-753: Add aria-label for ProfileDropdown.js (#1382)
1 parent 01c5d6c commit 35799e8

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Export `getEventHandler` to be able to create events in other modules. Refs STCOR-770.
1313
* Opt-in: handle access-control via cookies. Refs STCOR-671.
1414
* Opt-in: disable login when cookies are disabled. Refs STCOR-762.
15+
* Add arial-label for `ProfileDropdown.js`. Refs STCOR-753.
1516

1617
## [10.0.0](https://github.com/folio-org/stripes-core/tree/v10.0.0) (2023-10-11)
1718
[Full Changelog](https://github.com/folio-org/stripes-core/compare/v9.0.0...v10.0.0)

src/components/MainNav/AppList/AppList.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class AppList extends Component {
122122
* The button that toggles the dropdown
123123
*/
124124
renderDropdownToggleButton = ({ open, getTriggerProps }) => {
125-
const { dropdownToggleId, intl: { formatMessage } } = this.props;
125+
const { dropdownToggleId } = this.props;
126126
const icon = (
127127
<svg className={css.dropdownToggleIcon} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
128128
<path d="M8.4 2.4H5.1c-1.5 0-2.7 1.2-2.7 2.7v3.3c0 1.5 1.2 2.7 2.7 2.7h3.3c1.5 0 2.7-1.2 2.7-2.7V5.1c0-1.5-1.2-2.7-2.7-2.7zm.7 6c0 .4-.3.7-.7.7H5.1c-.4 0-.7-.3-.7-.7V5.1c0-.4.3-.7.7-.7h3.3c.4 0 .7.3.7.7v3.3zM18.9 2.4h-3.3c-1.5 0-2.7 1.2-2.7 2.7v3.3c0 1.5 1.2 2.7 2.7 2.7h3.3c1.5 0 2.7-1.2 2.7-2.7V5.1c0-1.5-1.2-2.7-2.7-2.7zm.7 6c0 .4-.3.7-.7.7h-3.3c-.4 0-.7-.3-.7-.7V5.1c0-.4.3-.7.7-.7h3.3c.4 0 .7.3.7.7v3.3zM8.4 12.9H5.1c-1.5 0-2.7 1.2-2.7 2.7v3.3c0 1.5 1.2 2.7 2.7 2.7h3.3c1.5 0 2.7-1.2 2.7-2.7v-3.3c0-1.5-1.2-2.7-2.7-2.7zm.7 6c0 .4-.3.7-.7.7H5.1c-.4 0-.7-.3-.7-.7v-3.3c0-.4.3-.7.7-.7h3.3c.4 0 .7.3.7.7v3.3zM18.9 12.9h-3.3c-1.5 0-2.7 1.2-2.7 2.7v3.3c0 1.5 1.2 2.7 2.7 2.7h3.3c1.5 0 2.7-1.2 2.7-2.7v-3.3c0-1.5-1.2-2.7-2.7-2.7zm.7 6c0 .4-.3.7-.7.7h-3.3c-.4 0-.7-.3-.7-.7v-3.3c0-.4.3-.7.7-.7h3.3c.4 0 .7.3.7.7v3.3z" />
@@ -138,7 +138,6 @@ class AppList extends Component {
138138
<NavButton
139139
data-test-app-list-apps-toggle
140140
label={label}
141-
aria-label={formatMessage({ id: 'stripes-core.mainnav.showAllApplicationsButtonAriaLabel' })}
142141
className={css.navMobileToggle}
143142
labelClassName={css.dropdownToggleLabel}
144143
onClick={this.toggleDropdown}

src/components/MainNav/ProfileDropdown/ProfileDropdown.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,20 @@ class ProfileDropdown extends Component {
241241
}
242242

243243
renderProfileTrigger = ({ getTriggerProps, open }) => {
244-
const { intl } = this.props;
244+
const { intl, stripes: { okapi } } = this.props;
245+
const userData = this.getUserData();
246+
const servicePointName = userData?.curServicePoint?.name;
247+
const tenantName = userData?.tenants?.find(({ id }) => id === okapi.tenant)?.name;
245248

246249
return (
247250
<NavButton
248-
ariaLabel={intl.formatMessage({ id: 'stripes-core.mainnav.myProfileAriaLabel' })}
251+
ariaLabel={intl.formatMessage(
252+
{ id: 'stripes-core.mainnav.myProfileAriaLabel' },
253+
{
254+
tenantName,
255+
servicePointName,
256+
}
257+
)}
249258
selected={open}
250259
className={css.button}
251260
icon={this.getProfileImage()}

translations/stripes-core/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"mainnav.topLevelLabel": "Primary",
106106
"mainnav.applicationListLabel": "Application List",
107107
"mainnav.appContextMenu": "Application context dropdown",
108-
"mainnav.myProfileAriaLabel": "My profile",
108+
"mainnav.myProfileAriaLabel": "{tenantName} {servicePointName} profile",
109109
"mainnav.skipMainNavigation": "Skip Main Navigation",
110110

111111
"mainnav.profileDropdown.locale": "Locale",

0 commit comments

Comments
 (0)