Skip to content

The radio button and checkbox examples should show how to create accessible group names #185

Closed
@dylanb

Description

@dylanb

The current examples for radio button and checkbox groupings do not show how to create accessible group labels.

Ideally, the radio button would not allow you to create it without a group label (because this is always an accessibility problem), however, in lieu of that, we should show these examples ONLY with group labels and also document the accessibility requirement for them.

Radio button example markup can be changed to the following

<form>
    <fieldset>
        <legend>Group Name</legend>
        <div id="radio">
            <input type="radio" id="radio1" name="radio" /><label for="radio1">Choice 1</label>
            <input type="radio" id="radio2" name="radio" checked="checked" /><label for="radio2">Choice 2</label>
            <input type="radio" id="radio3" name="radio" /><label for="radio3">Choice 3</label>
        </div>
    </fieldset>
</form>

The checkbox markup can be changed to the following

    <fieldset>
        <legend>Group Name</legend>
        <div id="format">
            <input type="checkbox" id="check1" /><label for="check1">B</label>
            <input type="checkbox" id="check2" /><label for="check2">I</label>
            <input type="checkbox" id="check3" /><label for="check3">U</label>
        </div>
    </fieldset>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions