Re: proposed change: links inside label elements

14.01.2014, 14:58, "Steve Faulkner" <faulkner.steve@gmail.com>:
> Thanks to all for the feedback on the proposal.
>
> I agree that restricting the use of links inside labels is not a good idea.
> What I have done is add a note in the spec about the positive effect for usability/accessibility of labels as it increases hit area of the labeled control, and that linking label text negates this.
> https://github.com/w3c/html/commit/11c025f70bf7364e37cec508592c99916f92c3c8
>
> further feedback welcome!

The usecase I've encountered multiple times is a list of categories (implemented as checkboxes with labels) where user can select multiple categories and then submit the form to view filtered results:

    <ul>
        <li><label>
            <input type="checkbox" name="foo" value="1" /> 
            <a href="/some/">Some category</a>
        </label></li>

        <li><label>
            <input type="checkbox" name="foo" value="2" /> 
            <a href="/another/">Another category</a>
        </label></li>

        <li><label>
            <input type="checkbox" name="foo" value="3" /> 
            <a href="/third/">Third category</a>
        </label></li>
    </ul>

Label text itself is _entirely_ wrapped in link intended to be used to go _directly_ to corresponding single-category page if the user wants to view the _single_ category without need for checking the single checkbox and submitting the form.

At the same time, link text also functions as label text useful for assistive technologies, so these links cannot be just moved outside their labels; labels themselves should not be removed for the same reason.

As a user, I'm not sure I very like this pattern, but it certainly makes some sense.

Also, we should remember that one of main goals of HTML5 was documenting existing behavior and implementations, so artificial validity-limitations should not be invented just for purely/mainly theoretical reasons.

So links inside labels should remain allowed by the HTML standard, and a spec note about undesirability of whole-label-text-is-link pattern in general is enough.

Thanks.

Received on Tuesday, 14 January 2014 16:57:17 UTC