WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Inputs that are Numbers only like Phone zipcode

for

Number of posts in this thread: 4 (In chronological order)

From: Nancy Johnson
Date: Thu, Aug 14 2014 11:34AM
Subject: Inputs that are Numbers only like Phone zipcode
No previous message | Next message →

If the field is restricted to numbers only like a phone or zip code.
From the Accessibility perspective is it better to add a warning in
the form of label or client-side validation?

Currently the engineers are restricting the field but no warning

Thanks

Nancy

From: Jukka K. Korpela
Date: Thu, Aug 14 2014 12:22PM
Subject: Re: Inputs that are Numbers only like Phone zipcode
← Previous message | Next message →

2014-08-14 20:34, Nancy Johnson wrote:

> If the field is restricted to numbers only like a phone or zip code.
> From the Accessibility perspective is it better to add a warning in
> the form of label or client-side validation?
>
> Currently the engineers are restricting the field but no warning

I think the important things are:

Does the text before the field (possibly including its label) clearly
state what is expected?

How well does it deal with different types of input? In particular, a
phone input field should accept any spaces and some punctuation and
ignore it, not require it.

How does the page behave when the requirements are not met?

A label should never carry a warning. It should say what is expected,
not what errors may have occurred.

For a phone number, I would primarily use <input type=tel ...> and
possibly use JavaScript checks to check the number.

For a zip code, I would use <input pattern="...">, possibly using
JavaScript to check the input on old browsers.

Yucca

From: Sailesh Panchang
Date: Thu, Aug 14 2014 12:43PM
Subject: Re: Inputs that are Numbers only like Phone zipcode
← Previous message | Next message →

Try aria-invalid if form's label is clear like the field for PIN on
http://mars.dequecloud.com/demo/form-alert3.htm
This page also demonstrates a couple of other methods.
Hope this helps.
Regards,
Sailesh


On 8/14/14, Jukka K. Korpela < = EMAIL ADDRESS REMOVED = > wrote:
> 2014-08-14 20:34, Nancy Johnson wrote:
>
>> If the field is restricted to numbers only like a phone or zip code.
>> From the Accessibility perspective is it better to add a warning in
>> the form of label or client-side validation?
>>
>> Currently the engineers are restricting the field but no warning
>
> I think the important things are:
>
> Does the text before the field (possibly including its label) clearly
> state what is expected?
>
> How well does it deal with different types of input? In particular, a
> phone input field should accept any spaces and some punctuation and
> ignore it, not require it.
>
> How does the page behave when the requirements are not met?
>
> A label should never carry a warning. It should say what is expected,
> not what errors may have occurred.
>
> For a phone number, I would primarily use <input type=tel ...> and
> possibly use JavaScript checks to check the number.
>
> For a zip code, I would use <input pattern="...">, possibly using
> JavaScript to check the input on old browsers.
>
> Yucca
>
>
>
>
> > > >

From: Jonathan Avila
Date: Fri, Aug 15 2014 10:21AM
Subject: Re: Inputs that are Numbers only like Phone zipcode
← Previous message | No next message

> If the field is restricted to numbers only like a phone or zip code.
From the Accessibility perspective is it better to add a warning in the form of label or client-side validation?

In my opinion this question would fall under SC 3.3.2.
http://www.w3.org/TR/UNDERSTANDING-WCAG20/minimize-error-cues.html

The guidance document states "The intent of this success criterion is to have content authors place instructions or labels that identify the controls in a form so that users know what input data is expected."

So the real question is does the label or instruction communicate that it be numerical input? For something like a date field it may be slightly ambiguous -- but it may be ambiguous for all users regardless of disability. SC 3.3.2 does fall under the Guideline for helping users avoid and correct mistakes-- so perhaps use of error messages assist in meeting the requirement.

This is one of those situations where you could make an argument either way and it creates a slight risk to the organization and potential confusion to the user. It would be good to document the decision and the logic behind meeting the SC.

HTML5 Input types may also potentially assist in this situation although they may not be displayed to all users.

Jonathan

-----Original Message-----
From: = EMAIL ADDRESS REMOVED = [mailto: = EMAIL ADDRESS REMOVED = ] On Behalf Of Nancy Johnson
Sent: Thursday, August 14, 2014 1:35 PM
To: WebAIM Discussion List
Subject: [WebAIM] Inputs that are Numbers only like Phone zipcode

If the field is restricted to numbers only like a phone or zip code.
From the Accessibility perspective is it better to add a warning in the form of label or client-side validation?

Currently the engineers are restricting the field but no warning

Thanks

Nancy