Problem/Motivation
I was testing the module for the first time. As the first step i deliberately chose to enter a short password (6 lowercase letters). I ran into an error stating i havent met the minimum requirement for the password. there are two problems with that error. before entering the password i see only the recommended requirements from drupal core having at least 12 characters using uppercase letters, numbers and punctuation. there is no word that there is a minimum requirement for passwords in place. after sending the form with the too short password there is another problem the error message only states 1 error has been found: password which is just arbitrary and not meaningful. the explanation is shown inline under the confirm password field with passwords must be at least 8 characters. as you can see in the video that line isn't announced by a screenreader (voiceover in macos 12.6.1 is used in the video). a screenreader user would be unable to notice the root cause easily but has to step through the aural interface sequentially to spot the particular sentence.
Steps to reproduce
1. go to /user/1/edit
2. enter a password that is shorter than 8 characters
Proposed resolution
1. if possible it would be good to update the password description from To change the current user password, enter the new password in both fields. and change it to something like: To change the current user password, enter the new password in both fields. The password has to have at least 8 character.. It might be even an idea to add a third sentence that the entered password will be rated for its strength?
2. Change the error message from 1 error has been found: Password to something like Passwords must have at least 8 characters.or The chosen password was too short. The minimum requirement are eight characters. . That way the reason for the error is announced by screen readers in contrast to the inline error.
3. remove the inline error Passwords must be at least 8 characters underneath the confirm password field.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | better_passwords-minimum_length_error-3341916-2.patch | 2.63 KB | dtarc |
| minimum_requirement.mp4 | 1.28 MB | rkoller |
Comments
Comment #2
dtarc commentedHere's a patch.
Comment #4
duaelfrThank you for reporting this issue!
I merged most changes in the code for the upcoming release.
I heard what you said about the error not being clearly announced to screenreaders but the thing is that it's a Core design issue. The inline form errors pattern has been adopted in core since Drupal 8. It's supposed to be more accessible than having all errors directly in the messages section. I'm not an accessibility expert in any way but I've had to deal with some accessibility audits in the past that reported problems about other things related to form errors but not the way errors were presented to the user. For now, I decided to stick to the Core way of doing this, and thus, to properly display the full error under the field.
I believe it's still better than before for accessibility and I hope it will be better with Core continuing to work on the subject.