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

STCOR-753: Accessibility Issues - core components - Include label text in element's accessible name #1362

Closed
wants to merge 2 commits into from
Closed
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
16 changes: 3 additions & 13 deletions src/components/MainNav/ProfileDropdown/ProfileDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,13 @@
}

renderProfileTriggerLabel = ({ open }) => {
const { okapi } = this.props.stripes;
const userData = this.getUserData();
const servicePointName = userData?.curServicePoint?.name;
const tenantName = userData?.tenants?.find(({ id }) => id === okapi.tenant)?.name;

const hasLabel = Boolean(servicePointName || tenantName);

return (
hasLabel ? (
<>

Check failure on line 260 in src/components/MainNav/ProfileDropdown/ProfileDropdown.js

View workflow job for this annotation

GitHub Actions / build-npm

Expected indentation of 6 space characters but found 8

Check failure on line 260 in src/components/MainNav/ProfileDropdown/ProfileDropdown.js

View workflow job for this annotation

GitHub Actions / build-npm

Expected indentation of 6 space characters but found 8
<span className={css.button__label}>
{tenantName && <span>{tenantName}</span>}
{servicePointName && <span>{servicePointName}</span>}
</span>
<span className={css.button__label}>

Check failure on line 261 in src/components/MainNav/ProfileDropdown/ProfileDropdown.js

View workflow job for this annotation

GitHub Actions / build-npm

Expected indentation of 10 space characters but found 8

Check failure on line 261 in src/components/MainNav/ProfileDropdown/ProfileDropdown.js

View workflow job for this annotation

GitHub Actions / build-npm

Expected indentation of 10 space characters but found 8
<FormattedMessage id="stripes-core.mainnav.myProfileAriaLabel" />
</span>
<Icon icon={open ? 'caret-up' : 'caret-down'} />
</>
) : null
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('ProfileDropdown', () => {
it('should display current consortium (if enabled) in the dropdown trigger', () => {
renderProfileDropdown();

expect(screen.getByText('Central office')).toBeInTheDocument();
expect(screen.getByText(/mainnav.myProfileAriaLabel/)).toBeInTheDocument();
});

it('should display module profile dropdown item', () => {
Expand Down
2 changes: 1 addition & 1 deletion translations/stripes-core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"settingSystemInfo": "System information",
"settingChoose": "Choose settings",

"mainnav.showAllApplicationsButtonLabel": "Apps",
"mainnav.showAllApplicationsButtonLabel": "All applications",
"mainnav.showAllApplicationsButtonAriaLabel": "All applications",
"mainnav.currentAppAriaLabel": "Current open application: {appName} (Click to go home)",
"mainnav.topLevelLabel": "Primary",
Expand Down
Loading