-
Notifications
You must be signed in to change notification settings - Fork 210
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
fix(payments-next): Implement a11y improvements #17056
Conversation
❌ Deploy Preview for mozilla-fxa-react failed.
|
❌ Deploy Preview for mozilla-fxa failed.
|
❌ Deploy Preview for mozilla-fxa-payments-server failed.
|
❌ Deploy Preview for mozilla-fxa-settings failed.
|
1884120
to
7b0e3ca
Compare
serverInvalid={hasFullNameError} | ||
className="my-6" | ||
> | ||
<Form.Label className="text-[15px] text-grey-400 block mb-1 text-start"> |
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.
Would built-in text-sm
(14px) or text-base
(16px) work instead of a custom font size?
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.
I updated this to use a custom size for a more unified look with the labels and error messages used in the Stripe Payment Element (15px).
Note: the base font size for the Stripe Payment Element is currently set to 16px.
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.
Fly-by comment:
I guess there's no way to update the stripe payment element? Sad. Can we at least use rem
s, or is stripe payment also px
?
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.
Apologies, clarification on the note - we had set the Stripe Payment Element to have a base font-size of 16px.
It looks like the Element does its own calculations from the base font size, so that its labels and error message use 15px (.93rem).
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.
Looking at the Stripe Appearance API, it might be possible to set the Stripe Elements sizes. https://docs.stripe.com/elements/appearance-api
{hasFullNameError && ( | ||
<Form.Message asChild> | ||
<Localized id="next-payment-validate-name-error"> | ||
<p className="text-[15px] mt-1 text-alert-red" role="alert"> |
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.
Same Q as above, re: font-size.
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.
See above for reasoning.
id="next-payment-confirm-with-legal-links-static-3" | ||
elems={{ | ||
termsOfServiceLink: ( | ||
<LinkExternal |
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.
I think all these 2-4 <LinkExternal>
components will end up having the same default data-testid
prop, if that's an issue. 🤷
'data-testid': testid = 'link-external',
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.
Updated, thanks Peter!
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.
I've left a few comments. I appended the comments with either "Clarification question", where I thought it might be worth while having a discussion, or "Change required" where it seems a change is necessary.
libs/payments/ui/tsconfig.lib.json
Outdated
@@ -19,5 +19,5 @@ | |||
"src/**/*.spec.jsx", | |||
"src/**/*.test.jsx" | |||
], | |||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] | |||
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx", "../../shared/react/src/components/LinkExternal.tsx"] |
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.
Change required. This should be removed. The payments-ui
lib shouldn't be responsible for building components from shared-react
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.
Removed!
{!isPaymentElementLoading && ( | ||
<Form.Submit asChild> | ||
<Localized id="next-new-user-submit"> | ||
<PrimaryButton |
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.
Change required. The submit button is clickable, even during the disabled state, when the checkbox has not been selected yet. The rest of the disabled area has a no-cursor
icon.
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.
I pushed an update for all the other changes - working on this one now.
apps/payments/next/app/[locale]/[offeringId]/checkout/[interval]/[cartId]/start/page.tsx
Show resolved
Hide resolved
tsconfig.base.json
Outdated
@@ -58,6 +58,7 @@ | |||
"@fxa/shared/notifier": ["libs/shared/notifier/src/index.ts"], | |||
"@fxa/shared/otp": ["libs/shared/otp/src/index.ts"], | |||
"@fxa/shared/pem-jwk": ["libs/shared/pem-jwk/src/index.ts"], | |||
"@fxa/shared/react/*": ["libs/shared/react/src/*"], |
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.
Change required. Is this the alias that was generated by the nx generator? Why is it different from the typescript libraries?
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.
No, I updated it to match shared-assets. I'll revert.
8a36b05
to
1351176
Compare
className={ | ||
formEnabled | ||
? '' | ||
: 'cursor-not-allowed relative focus:border-blue-400 focus:outline-none focus:shadow-input-blue-focus after:absolute after:content-[""] after:top-0 after:left-0 after:w-full after:h-full after:bg-white after:opacity-50 after:z-10' | ||
} |
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 shouldn't be necessary. The
cursor-not-allowed
should also apply to the button.
I had a look at SP2, and it looks like the PrimaryButton
is missing class z-[5], which we can probably replace with z-10. Adding that should work. (Note, this can be added to the PrimaryButton
component directly)
{!isPaymentElementLoading && ( | ||
<Form.Submit asChild> | ||
<Localized id="next-new-user-submit"> | ||
<div |
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 is missing the mt-14
which adds a bit of space between the checkbox and the Enter your card information
.
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.
lgtm, ty!
This pull request
tabindex=-1
to disabled form elements that should not be reachabledisabled
from div so screen reader does not mis-read that the “Name as it appears on your card” field is dimmed when checkbox is checked<hr>
as<hr>
was separating information (e.g., 1. Create a Mozilla account / Already have a Mozilla account? Sign in heading and form section, Purchase details list prices and total section)<li></li>
and moved into<ul></ul>
as price items should be grouped and improve readability of list price items in Purchase detailsIssue that this pull request solves
Closes: FXA-9708
Checklist
Put an
x
in the boxes that apply