-
Notifications
You must be signed in to change notification settings - Fork 446
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
Improving accessibility on the new user registration page #3272
Improving accessibility on the new user registration page #3272
Conversation
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.
@Andrea-Guevara : Thanks for this PR. We reviewed this PR as a group in today's Developers Meeting. I've captured the feedback from the team in inline comments below.
Overall it looks good, but there's some code cleanup that is needed.
This PR also needs to be tested by someone (which I can do after the code cleanup is done), but the code itself looks like it should work.
.github/workflows/build.yml
Outdated
@@ -11,7 +11,7 @@ permissions: | |||
|
|||
jobs: | |||
tests: | |||
runs-on: ubuntu-latest | |||
runs-on: [self-hosted, acervos] |
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.
All the changes to the .github/workflows/
files in this PR will need to be removed before this can be merged. So, there are 6 files you've accidentally changed under that folder which need to be reverted.
@@ -14,13 +14,16 @@ <h1>{{MESSAGE_PREFIX + '.header'|translate}}</h1> | |||
<label class="font-weight-bold" | |||
for="email">{{MESSAGE_PREFIX + '.email' | translate}}</label> | |||
<input [className]="(email.invalid) && (email.dirty || email.touched) ? 'form-control is-invalid' :'form-control'" | |||
type="text" id="email" formControlName="email"/> | |||
type="text" id="email" formControlName="email" | |||
[attr.aria-label]="'register-email.aria.label'|translate" |
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.
On this line, we'd recommend changing the label to be: MESSAGE_PREFIX + '.aria.label' | translate
because the MESSAGE_PREFIX
is used for other labels in this same file. See above on line 15.
type="text" id="email" formControlName="email" | ||
[attr.aria-label]="'register-email.aria.label'|translate" | ||
aria-describedby="email-errors-required email-error-not-valid" | ||
[attr.aria-invalid]="form.get('email')?.invalid"/> |
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.
You can likely simplify this to be [attr.aria-invalid]="email.invalid"
, similar to the next line (which also uses email.invalid
). It's best to use the same check just for consistency.
Good afternoon, thank you very much for your feedback @tdonohue! I was wondering if you would prefer me to make a new PR available with the proposed changes? that way the code will be cleaner |
@Andrea-Guevara : There is no need to make a new PR. If you feel comfortable doing so, you should be able to use It is also possible to "squash" multiple commits into a single commit using |
Good afternoon @tdonohue! The changes that have been made to the .github/workflows/ files are internal company orders so I won't be able to undo them. I'll be back soon with a solution to this inconvenience. I'll possibly make a new PR available. |
@Andrea-Guevara : Ok, just to be aware, we are unable to merge any PR which includes changes to In case it isn't clear, merging those changes would cause all DSpace PRs (from every institution in the world) to use your company settings. That would not be desirable for DSpace or for your company. |
I understand! I'll make sure that doesn't happen |
@Andrea-Guevara : I was just looking around at your other recent PRs, and it looks like they all include this new change to I wanted to make sure you are aware that this seems to have been pushed to all PRs from you. |
Thanks for the comment! It'll work out hehe |
7578001
to
0eb2d5c
Compare
…gotten password forms
Good morning @tdonohue, I hope you're well! After internal discussions, we have reached a consensus and reverted the commit that contained the aforementioned files. We've also done the code refactoring that was requested. Looking forward to your feedback! |
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.
@Andrea-Guevara : Apologies for the delay in getting back to this. The basics of this PR work, but I'm not sure we should hardcode the aria-describedby
on the email field. See my inline comment below.
type="text" id="email" formControlName="email"/> | ||
type="text" id="email" formControlName="email" | ||
[attr.aria-label]="MESSAGE_PREFIX + '.aria.label' | translate" | ||
aria-describedby="email-errors-required email-error-not-valid" |
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'm not sure this aria-describedby
should be hardcoded. If there are no errors on the form, then both "email-errors-required" and "email-error-not-valid" will not exist. In that scenario, won't this aria-describedby
be incorrect?
It seems like the aria-describedby
field should be more dynamic. It should say email-errors-required
if email.errors
is true, but it should say email-error-not-valid
if email.invalid
is true. If no errors exist, then it seems like aria-describedby
should also not exist.
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.
Hello, good afternoon @tdonohue!
Certainly if there is no error in the form the “aria-describedby” is not necessary, but in this case, its purpose is to announce to users who make use of assistive technology that there are errors in the form and therefore it is not possible to continue. Like sometimes, we type our email in the wrong way and don't realize it hehe.
Do you think this isn't necessary, or do you know of a better way to address this issue?
I welcome your suggestions. Looking forward to hearing from you!
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.
Hi @Andrea-Guevara : The problem that I see is that when there are no errors, then aria-describedby="email-errors-required email-error-not-valid"
will point at fields that do not exist in the page. In other words, the email-errors-required
field ONLY exists if the email is empty. And, the email-error-not-valid
field ONLY exists if an invalid email is entered.
So, it seems like the aria-describedby
should ONLY point at fields which exist. If an error field is visible, then it should be listed in the aria-describedby
. But, if there are no errors, then the aria-describedby
should be empty (or not exist).
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.
If it's not clear, I agree that we need the aria-describedby
attribute to notify users of errors in the form. But, I feel that attribute should not exist when there are no errors in the form (otherwise, it is notifying users of something that doesn't exist). The aria-describedby
also should only ever have one value (at most), because either the email-errors-required
error will exist, or the email-error-no-valid
error will exist (but not both at the same time).
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.
Hello @tdonohue
Thank you very much for your feedback. I understand your comment! I've provided a possible fix
I look forward to hearing from you
type="text" id="email" formControlName="email"/> | ||
type="text" id="email" formControlName="email" | ||
[attr.aria-label]="MESSAGE_PREFIX + '.aria.label' | translate" | ||
[attr.aria-describedby]="ariaDescribedby" |
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.
@Andrea-Guevara : I think you can make this dynamic in a much easier way.
Something like this should work:
[attr.aria-describedby]="(!email.errors) ? '' : (email.errors.required ? 'email-errors-required' : 'email-error-not-valid')"
That logic is just an if/else structure. If there are no errors (!email.errors
) have an empty string in aria-describedby
. Otherwise, put in the correct error field ID based on whether email.errors.required
is true or false.
I think this logic would be a lot easier to understand. It'd also allow you to remove all of your recent changes to the register-email-form.component.ts
class.
(You'll also see similar if/else structures in other HTML attributes in this same file, so this is more similar to the current code.)
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.
@tdonohue Your code suggestion works perfectly. Thank you very much :)
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.
👍 Thanks @Andrea-Guevara This now looks good. I tested it and it seems to be working well now.
Successfully created backport PR for |
Successfully created backport PR for |
References
Description
Use of the attributes “attr.aria-label”, “aria-describedby” and “attr.aria-invalid” to improve the user experience when browsing DSpace using a screen reader.
Instructions for reviewers
Use of the “attr.aria-label” attribute which provides a clear description of what the user needs to do in the email field. Use of the “aria-describedby” attribute which describes error messages and use of the “attr.aria-invalid” attribute which informs when a field is invalid.
List of changes in this PR:
Note: This PR does not deal with the accessibility of the “Register” button as there is already a PR dealing with this issue.
#3268
To reproduce: