GSA / notifications-admin

The UI of Notify.gov
https://notify.gov
Other
11 stars 2 forks source link

Send Message A11Y Audit - Unique IDs #2125

Open jonathanbobel opened 3 days ago

jonathanbobel commented 3 days ago

Issue: Ensure Form Elements Have Unique IDs

Problem:
Some form elements in the Send Message flow use non-unique IDs such as placeholder_value. According to accessibility standards and best practices, each element must have a unique ID. Duplicate IDs can lead to:

  1. Accessibility issues for users relying on assistive technologies, as screen readers cannot correctly associate labels or error messages with specific elements.
  2. JavaScript errors or unpredictable behavior when manipulating elements by ID.
  3. Parsing errors that violate the HTML specification and WCAG guidelines.

Relevant WCAG Success Criterion:


Steps to Reproduce:

  1. Open a form in the application.
  2. Inspect form elements using the browser developer tools.
  3. Observe that some elements share the same id attribute, such as placeholder_value.

Proposed Solution:

  1. Assign Unique IDs to All Form Elements:

    • Replace generic or duplicate IDs with unique, meaningful IDs. For example:

      <!-- Before -->
      <input id="placeholder_value" name="email">
      <input id="placeholder_value" name="username">
      
      <!-- After -->
      <input id="email" name="email">
      <input id="username" name="username">
  2. Update Related References:

    • Update any attributes that reference the IDs (e.g., for, aria-labelledby, aria-describedby) to match the new unique IDs.
  3. Generate IDs Dynamically (if applicable):

    • For programmatically generated forms, implement logic to generate unique IDs for each form element.

Acceptance Criteria:


References:


By addressing this issue, we ensure that the application meets accessibility standards and provides a better user experience for all users.