Skip to content

fix(z-input): add aria-describedby for password fields#629

Open
ada-workbackai wants to merge 1 commit intomasterfrom
workbackai/fix/wcag-3.3.2-password-requirements
Open

fix(z-input): add aria-describedby for password fields#629
ada-workbackai wants to merge 1 commit intomasterfrom
workbackai/fix/wcag-3.3.2-password-requirements

Conversation

@ada-workbackai
Copy link
Copy Markdown
Contributor

Summary

Fixes WCAG 3.3.2 (Labels or Instructions) Level A by adding programmatic association between password input fields and their requirement instructions via aria-describedby.

Issue: Password fields in registration forms lack instructions about password requirements (minimum length, character types, etc.). Screen reader users cannot access these requirements if they are not programmatically associated with the input field, leading to form abandonment and accessibility violations.

Solution: Modified the z-input component to automatically add aria-describedby attribute when a message prop is provided, linking the input to the helper text element.

Changes

  • Added aria-describedby attribute to input elements when message prop is set
  • Added id attribute (${htmlid}_message) to z-input-message component
  • Added password example story demonstrating proper usage with requirements text
  • Fixed label class name for consistency (z-labelinput-label)

Test Plan

  • Added story example showing password field with requirements message
  • Verified aria-describedby correctly references message element ID
  • Lint checks pass
  • Message is programmatically associated and announced by screen readers

Usage Example

<z-input
  type="password"
  label="Password"
  placeholder="Inserisci la password"
  required={true}
  minlength={8}
  message="La password deve contenere almeno 8 caratteri"
/>

This will render an input with aria-describedby="input-id_message" referencing the message element, ensuring screen readers announce the requirements when the field receives focus.

Evidence

View before/after screenshots and full audit details:
https://app.workback.ai/dashboard/issue/5036/


WCAG Reference:
3.3.2 Labels or Instructions (Level A)

Adds programmatic association between password inputs and their requirement
messages to meet WCAG 3.3.2 (Labels or Instructions) Level A compliance.

Changes:
- Added aria-describedby attribute to input elements when message prop is provided
- Added id attribute to z-input-message component for reference
- Added password example story demonstrating proper usage with requirements
- Updated label class name for consistency

User impact: Screen reader users now hear password requirements when focusing
on password fields, preventing form abandonment due to unclear validation rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant