Skip to content

(fix) Translate hard-coded accessible names in the primary navigation - #2039

Open
kirill-morozov-n wants to merge 1 commit into
openmrs:mainfrom
kirill-morozov-n:translate-navigation-aria-labels
Open

kirill-morozov-n wants to merge 1 commit into
openmrs:mainfrom
kirill-morozov-n:translate-navigation-aria-labels

Conversation

@kirill-morozov-n

Copy link
Copy Markdown

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work is based on designs, which are linked or shown either in the Jira ticket or the description below. (See also: Styleguide)
  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework and storybook mocks (mock.tsx, mock-jest.tsx, and storybook mocks) to reflect any API changes.

Summary

Six accessible names in the primary navigation were hard-coded in English, so screen reader users heard them in English in every locale. They now go through t(), and their keys are added to esm-primary-navigation-app/translations/en.json:

Element Key
navbar Header (the banner landmark) openmrs: "OpenMRS"
hamburger HeaderMenuButton (Carbon also uses it as the button's title) openMenu: "Open menu"
default logo svg openmrsLogo: "OpenMRS Logo"
notifications HeaderPanel notificationsPanel: "Notifications Panel"
app menu HeaderPanel appMenuPanel: "App Menu Panel"
user name SwitcherItem in the user menu user: "User"

The English text is unchanged. openmrsLogo is the key the login footer already uses for the same logo, and the user menu HeaderPanel and the other SwitcherItems already label themselves this way.

The en.json entries come from extract-translations (i18next-parser), and nothing else changed in that file. Checks:

  • yarn turbo run lint test typescript --filter=@openmrs/esm-primary-navigation-app: lint and typecheck pass, 30 tests pass;
  • eslint --max-warnings 0 and prettier on the changed files;
  • the logo, notifications panel and user switcher tests now also check these names.

The login footer has one hard-coded label, aria-label="Arrow right icon" on the framework ArrowRightIcon. I left it alone: the framework Icon only renders className, fill and size, so that label never reaches the DOM.

Screenshots

None — the change only affects accessible names; see the tests.

Related Issue

None. It is a follow-up to the same kind of fix in openmrs/openmrs-esm-patient-chart#3898 and openmrs/openmrs-esm-patient-management#2887.

Other

AI disclosure: implemented with Claude Code; I reviewed the changes and ran the tests listed above.

@changeset-bot

changeset-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5806fb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Dec 2, 2026

Copy link
Copy Markdown

security Security Review

This PR appears safe to merge from a security standpoint.

What was checked
  • All six aria-label changes only replace hard-coded English strings with t() calls using the same English text as fallback.
  • The new translation keys live in the repo's static en.json file, so no untrusted input flows into these labels.
  • Translated labels render through React's aria-label attribute handling, which escapes values, so translated messages cannot inject markup.
  • No authentication, authorization, navigation, or network handling changed in this PR, and no dependencies were added.

@greptile-apps

greptile-apps Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge.

Summary

No actionable issues found.

  • The navigation banner and menu button get translated names.
  • The app and notifications panels get translated names.
  • The default navigation logo gets a translated name.
  • The user-menu item gets a translated name.

Reviews (1) · Last reviewed commit: "(fix) Translate hard-coded accessible na..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant