Add aria-pressed attribute to all toggleVisibility buttons #2232
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
Currently, the show/hide buttons to toggle the visibility of passwords/hidden fields don't expose their state to assistive technologies - they only change visually by swapping out the fontawesome icon used. Adding
aria-pressed="false"
/aria-pressed="true"
makes these proper toggle buttons, whose state is exposed to assistive tech. This way a screen reader user can hear whether the password/hidden field is visible or not visible.Closes #2228
Code changes
For all the various
toggleVisibility
buttons used, adds[attr.aria-pressed]
referencing the relevant value (e.g.showPassword
). Toggling the button dynamically changes the value of the attribute that's rendered.Screenshots
No UI change
Testing requirements
Test with a screen reader (e.g. NVDA). Alternatively, check that the
aria-pressed
attribute in the DOM is present and correctly toggles between literaltrue
andfalse
values (true when the password is visible and the icon isfa-eye-slash
, false when the password is hidden and the icon isfa-eye
)Before you submit
npm run lint
) (required)