-
Notifications
You must be signed in to change notification settings - Fork 143
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
Change all ARIA labels to translatable messages #1572
Conversation
Also a bit of cleanup!
Also simplify guest/registered user logic.
const path = buildUrl('/account') | ||
history.push(path) | ||
} else { | ||
// if they already are at the login page, do not show login modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug reported from UX awhile ago saying if a user is current in login page, the account click should not show the modal since user is already seeing the login form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That bug is also handled by the withRegistration
component. Although I noticed that here the logic handled /login
, and the withRegistration
component handles /{locale}/login
, but what the app actually uses is /global/{locale}/login
. I've changed the withRegistration
component to be more flexible.
packages/template-retail-react-app/app/components/header/index.jsx
Outdated
Show resolved
Hide resolved
Signed-off-by: Will Harney <[email protected]>
withRegistration component detects /{locale}/login, but app uses /global/{locale}/login and /login.
|
||
const handleClick = (e) => { | ||
e.preventDefault() | ||
if (!customer.isRegistered) { | ||
// Do not show auth modal if users is already on the login page | ||
if (isLoginPage) { | ||
if (isLoginPage(location, locale)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is locale being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not here, but it was in the original implementation, so I figured we'd keep it to make customizations easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one place that defines the isLoginPage which does not take locale. I don't think we need to do it here. 🤔 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locale was used previously:
pwa-kit/packages/template-retail-react-app/app/components/with-registration/index.jsx
Line 22 in 9baf1c8
const isLoginPage = new RegExp(`^/${locale}/login$`).test(location.pathname) |
Because our default implementation has multiple login pages (/login, /en-GB/login, /global/en-GB/login), I decided to change the isLoginPage
logic. But, to make it easier for customers to implement the previous logic (or any locale-dependent custom logic), I think it's reasonable to also provide locale
.
Signed-off-by: Will Harney <[email protected]>
Description
Noticed when reviewing #1570 that the ARIA labels were hard-coded strings, rather than translatable messages. Did a quick search in the project to find all the other instances of that. Spotted a few small issues along the way, so I fixed those as well.
Types of Changes
Changes
How to Test-Drive This PR
To test that the messages are now translatable:
To test other changes
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization