WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Fieldset/legend as label for textbox or textarea?

for

From: Isabel Holdsworth
Date: Apr 18, 2018 3:17AM


Cheers Birkir, you're a minefield of useful info :-)

On 17/04/2018, Birkir R. Gunnarsson < <EMAIL REMOVED> > wrote:
> <fieldset>/<legend> does not assign an accessiblename to individual
> form fields, so it is a fail of 4.1.2
> It assigns a name to a group and the form field is part of that group,
> but it does not assign the name to the field itself.
> In the absence of anything else, a screen rader may assign the group
> label to the field, rather than saying nothing, but technically it has
> no name.
> Also, it could be argued thatthis vilates WCAG 1.3.1 if a visible
> label is not properly associated with the input control (and it
> reduces the size of the click target by not including the label text).
>
> If the legend text is clearly associated with form fields visually it
> is sufficient to give them a screen reader only label (using
> aria-label or title).
> See technique h65:
> http://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/H65
> (but this is questionabl, because it does not create he aforementioned
> larger click target).
>
> Ditto if the visual labeling is done by an adjacent control.
> See general technique 167:
> http://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G167
> (same problem).
>
>
>
> On 4/17/18, Isabel Holdsworth < <EMAIL REMOVED> > wrote:
>> Much appreciated as always Steve. My justification for fixing this
>> needs to be WCAG-based - would you say this is a fail or rather an
>> edge case?
>>
>> Cheers.
>>
>> On 17/04/2018, Steve Faulkner < <EMAIL REMOVED> > wrote:
>>>>This feels like an incorrect use of fieldset/legend to me, as it's
>>>>supposed to be a group label for checkboxes or radiobuttons.
>>>
>>> you are correct, use <label> for individual checkboxes and radio buttons,
>>> fieldset/legend for group labels.
>>>
>>> --
>>>
>>> Regards
>>>
>>> SteveF
>>> Current Standards Work @W3C
>>> <http://www.paciellogroup.com/blog/2015/03/current-standards-work-at-w3c/>;
>>>
>>> On 17 April 2018 at 15:19, Isabel Holdsworth < <EMAIL REMOVED> >
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> We're currently using a fieldset/legend wrapper to label some of our
>>>> textboxes, but it doesn't work well with JAWS.
>>>>
>>>> This feels like an incorrect use of fieldset/legend to me, as it's
>>>> supposed to be a group label for checkboxes or radiobuttons.
>>>>
>>>> Would fieldset/legend in this scenario be enough to pass WCAG2, or
>>>> would it fail on 2.4.6 (headings and labels) and/or 4.1.2 (name, role,
>>>> value)?
>>>>
>>>> Thanks as always.
>>>> >>>> >>>> >>>> >>>>
>>> >>> >>> >>> >>>
>> >> >> >> >>
>
>
> --
> Work hard. Have fun. Make history.
> > > > >