Skip to content
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

SC 332 -- Form input label and helper text #19

Open
damiansian opened this issue Jan 4, 2025 · 0 comments
Open

SC 332 -- Form input label and helper text #19

damiansian opened this issue Jan 4, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@damiansian
Copy link

damiansian commented Jan 4, 2025

URL

https://demo.fileyourstatetaxes.org/en/questions/phone-number

Issue

The current label of the text input is not creating a consistent accessible name. There are two p tags in the label tag. This is causing errors on VoiceOver likely due to the fact we're using block level elements inside an inline element.

P tags in the label tag

<label for="state_file_phone_number_form_phone_number">
  <p class="form-question">Your phone number</p>
<p class="text--help">Enter numbers only</p>
</label>

Screen shot

Image

Video walkthrough

form_label_auto_complete_error.mov

Note

The aria-required="true" was added after creating this screen recording.

WCAG Success Criterion

SC 3.3.2: Labels or Instructions (Level A)

Impacted users

Screen reader users rely on labels and instructions to understand how to fill out form elements properly.

Suggested fix

This suggestion fixes the issues on Mac and PC screen readers and brings the form element up to full WCAG conformance. There are other issues solved for here that have separate bugs filed.

What changed:

  • Added autocomplete (SC 1.3.5)
  • Associated helper text (SC 3.3.2)
  • Added required since skipping entry causes and error (SC 3.3.1 and SC 3.3.2)
  • Used aria-describedby for helper text AND error text.

Current

<label for="state_file_phone_number_form_phone_number"><p class="form-question">Your phone number</p>
<p class="text--help">Enter numbers only</p>
</label>
<input 
    autocomplete="off" 
    autocorrect="off" 
    autocapitalize="off" 
    spellcheck="false" 
    type="text" 
    class="form-width--long text-input" 
    id="state_file_phone_number_form_phone_number" 
    name="state_file_phone_number_form[phone_number]">

    </div>

Should be:

<label id="label" for="phone">Your phone number</label>
<input 
  type="text" 
  name="phone" 
  id="phone" 
  autocomplete="tel" 
  aria-describedby="helper"
  aria-required="true">
<p id="helper">Enter numbers only</p>
</div>
@damiansian damiansian added the bug Something isn't working label Jan 4, 2025
@damiansian damiansian changed the title SC 332 -- Helper text SC 332 -- Form input label and helper text Jan 4, 2025
@mmazanec22 mmazanec22 moved this from To triage to Ticket created in NJ Innovate -- NJ Direct File Accessibility Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ticket created
Development

No branches or pull requests

1 participant