WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: enter key to check radio button?

for

From: Birkir R. Gunnarsson
Date: Apr 21, 2022 3:56PM


WCAG 3.2.2 )oninput) does not allow for submitting forms by changing
the setting of a user interface component (i.e. typing into a text
input, checking a checkbox or selecting a radio button), not without
prior warning at least.
There is a bit of a tradition that pressing enter with focus on a text
input submits forms, though it can cause inadvertent submissions for
users who are trying to create a new line.
In my experience, I've gone with the following:
If the form is a single edit field, like a search (with or without a
search button), pressing enter with focus in that field can trigger
the button function (search function).
If you have anything more complex than that, (e.g. multiple input
fields or a field with other controls), you need a separate submit
button. Enter key should only submit the form with focus on that
button (not anywhere else on the form).

The expected pattern to check radio buttons or checkboxes is to press
spacebar with focus on that input (with radio buttons pressing arrow
keys up/down also navigates to and selects the adjacent radio button).
Screen reader users are able to use either the spacebar or the enter
key on most check and select controls, because in browse mode, a
screen reader generates a click event when one of those two keys are
pressed, not a keyboard event, keyboard only users are not used to
that.


On 4/21/22, Vaibhav Saraf < <EMAIL REMOVED> > wrote:
> Hi David,
>
> I can tell from my experience both as a sighted user and later as a screen
> reader user that Submit on Enter doesn't work the same way for the screen
> readers. NVDA and JAWS, for instance catch the onclick event on hitting
> Space and Enter, hence you will observe that a radio button or checkbox is
> operable with Enter on a screen reader even though it is not operable with
> the same key without the screen reader on.
>
> Hi Mike,
>
> My experience is very much limited as compared to the experts present on
> the list, I'll just share with you what you observed so far during user
> interactions which I did. Most of the users tend to go with the default
> keys, like Space for radios and checkboxes, Alt + down arrow for a
> dropdown, etc., with ofcourse a few exceptions.
>
> My personal opinion would be to implement the user ask if it is an
> Enterprise application meant for a small audience including the user. If
> otherwise, I would agree with you that accessibility lies in consistency.
>
> Thanks,
> Vaibhav
>
>
>
>
>
> On Thu, 21 Apr 2022 at 16:32, David Farough < <EMAIL REMOVED> >
> wrote:
>
>> I think that verifying that focus is on the submit button makes sense
>> before automatically submitting the form.
>> A screen reader user will need to hit enter in order to trigger focus mode
>> in order to type into an edit field for example.
>> Automatically submitting the form regardless of the current focus would be
>> annoying to say the least!
>>
>> -----Original Message-----
>> From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of
>> Mike Warner
>> Sent: Thursday, April 21, 2022 2:59 PM
>> To: <EMAIL REMOVED>
>> Cc: WebAIM Discussion List < <EMAIL REMOVED> >
>> Subject: Re: [WebAIM] enter key to check radio button?
>>
>> Thanks, TJ. I don't know which key they want to submit the form. (I sent
>> a
>> follow-up email to ask) Since consistency is the rule of accessibility, it
>> seems that this could cause more confusion than it prevents. For example,
>> keyboard-only users who expect to submit forms using the enter key,
>> because that's how it works everywhere else. I can add an event listener
>> to the radio buttons (and checkboxes) to prevent the default action of the
>> enter key, allowing it to check the box/button, but would that be
>> confusing
>> to some users?
>>
>> Mike
>>
>> Mike Warner
>> Director of IT Services
>> MindEdge, Inc.
>>
>>
>> On Thu, Apr 21, 2022 at 2:32 PM TJ McElroy < <EMAIL REMOVED> > wrote:
>>
>> > Hi Mike,
>> >
>> > I do think that it is a reasonable request to have the enter key check a
>> > button,
>> > however it should also be able to submit the form.
>> >
>> > Your user does have a point, that you should allow for many different
>> ways
>> > to use the form
>> >
>> >
>> > Not to read to much into your question, but if your user does not want
>> the
>> > enter key to submit the form, what key do they suggest?
>> >
>> > TJ
>> >
>> >
>> > On 4/21/2022 1:37 PM, Mike Warner wrote:
>> >
>> > Hi all,
>> >
>> > we have a client who was saying that we should also allow the enter key
>> to
>> > check a radio button and not to let that enter key submit the form on
>> > the page. They said that we should be prepared for however a keyboard
>> user
>> > may try to check the button. I explained that spacebar is the standard
>> key
>> > for that and sent the W3C page that talks about it. Has anyone else
>> > been
>> > asked to accept the enter key to check a radio button? Is it a
>> reasonable
>> > request?
>> >
>> > Thanks,
>> > Mike
>> >
>> > Mike Warner
>> > Director of IT Services
>> > MindEdge, Inc.
>> > >> > >> > >> > >> >
>> >
>> >
>> >
>> > 6270 Corporate Drive
>> > Indianapolis, IN 46278
>> >
>> > bosma.org
>> >
>> > *Facebook <https://www.facebook.com/bosmaenterprises> / Twitter
>> > <https://twitter.com/Bosmaenterprise>* / *Linkedin*
>> > <
>> https://www.linkedin.com/company/306575?trk=tyah&trkInfo=clickedVertical%3Acompany%2CclickedEntityId%3A306575%2Cidx%3A2-1-2%2CtarId%3A1477402422293%2Ctas%3Abosma%20enterhttp://
>> >
>> > Bosma Enterprises office is closed Monday May 30th, for Memorial Day
>> > Holiday.
>> >
>> >> >> >> >> >> >> >> >>
> > > > >


--
Work hard. Have fun. Make history.