-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fixed accessibility issues in Forms #161
Conversation
Codecov Report
@@ Coverage Diff @@
## main #161 +/- ##
=======================================
Coverage 90.74% 90.74%
=======================================
Files 217 217
Lines 6301 6302 +1
Branches 308 308
=======================================
+ Hits 5718 5719 +1
Misses 496 496
Partials 87 87
Continue to review full report at Codecov.
|
ec2a59c
to
4852095
Compare
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 had one question, which came up in many, many places.
You should have someone more familiar with react review this as well.
aria-describedby="confirmPasswordError" | ||
/> | ||
<ErrorMessage | ||
name="confirmPassword" |
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 it necessary to add a name attribute to the error message component? Does this render as a <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.
(According to my knowledge)
The name attribute is not passed to our custom component and is used by Formik internally for associating the fields name in Formik state.
The name attribute is also required in case for ErrorMessage component.
Reference: https://formik.org/docs/api/errormessage
aria-describedby="oldPasswordError" | ||
/> | ||
<ErrorMessage | ||
name="oldPassword" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
aria-describedby="newPasswordError" | ||
/> | ||
<ErrorMessage | ||
name="newPassword" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
aria-describedby="confirmPasswordError" | ||
/> | ||
<ErrorMessage | ||
name="confirmPassword" |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -123,7 +123,7 @@ export class AccountSettingsPage extends React.Component<Props> { | |||
> | |||
<div className="container auth-page account-settings-page"> | |||
<div className="auth-header"> | |||
<h1>User Settings</h1> |
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 don't think this change is necessary, and I have an open PR that updates this page layout anyway (#185). I think you can revert this change
className="form-control" | ||
autoComplete="given-name" | ||
aria-describedby="legal_address.first_nameError" |
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.
Our original mistake here was naming these form fields in a way that matches the API results, instead of giving them camel case names like our other forms and mapping the API results to those fields. This field should have name="firstName"
and the error should have id="firstNameError"
. That issue existed long before this PR though, so you definitely don't need to change all of these values here. In the meantime, this mixture of snake case and camel case is awkward. Can you change the naming scheme so that this value is legal_address.first_name.error
or legal_address.first_name_error
, whichever one you prefer? After that, please apply the same naming scheme to these other attributes that were added in this PR.
eae88a7
to
e743806
Compare
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 saw that we didn't get 100 on the profile and user settings forms. Can we improve those scores?
Regarding the User settings, I believe @gsidebo PR #185 will improve the score Issues in Profile Settings
This issue is handled by Arslan's header PR, Issue in User Settings
This will be handled in Gavin's PR |
name="confirmPassword" | ||
className="form-control" | ||
component={PasswordInput} | ||
aria-describedby="confirm_password_error" |
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.
Sorry, I don't think I was clear enough in my last review. I was suggesting that only the fields that already have the anti-pattern snake case attribute values (like name="profile.job_title"
) should have ids that are also snake case. I know it seems weird to have different patterns for the same attributes in different files, but eventually we're going to refactor those snake case attribute values (#186) and the id's/aria attributes can be updated as well. If you notice here, confirm_password_error
introduces three different conventions for attribute values in a single component. We have camel case for id
and name
, lowercase + dashes for className
, and now snake case for aria-describedby
. Dashes in CSS class names are already an understood convention that is specific to CSS. For other attributes, we should try to stick to camel case. So for example:
-->aria-describedby="confirm_password_error"
aria-describedby="confirmPasswordError"
-->aria-describedby="email_error"
aria-describedby="emailError"
Please apply that logic to all id
and aria-describedby
attributes in this PR except for the ones that are associated with a field that already has snake case attribute values (like legal_address.first_name
)
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 my first thought as well However please apply the same naming scheme to these other attributes that were added in this PR.
this line threw me off a bit and I assumed I had to apply the style to all attributes to maintain consistency.
I should have consulted you before hand, that was an oversight on my end and as requested above I have completed the required change.
9da70dd
to
ae47141
Compare
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.
Looks great! 👍
ae47141
to
d31363e
Compare
d31363e
to
9b5e049
Compare
9b5e049
to
14fc69b
Compare
Pre-Flight checklist
What are the relevant tickets?
Ticket #153
What's this PR do?
This PR has the following changes
How should this be manually tested?
Screenshots (if appropriate)
Light house score for local testing
