Skip to content

Checkboxes are not associated with their labels #1567

@trichoplax

Description

@trichoplax

Describe the bug
Checkboxes have nearby text to indicate what they are for, but this text is not associated so does not have the functionality of a label. As a result:

  • Checking or unchecking the checkbox requires a steady hand to precisely click the checkbox itself rather than its label (clicking the label does nothing). This affects users with imprecise mouse control and users on a touchscreen device.
  • The checkbox cannot be controlled through its label by assistive technologies such as screen readers.
  • The checkbox cannot be referred to by its label in system tests, preventing a test from taking the same approach as a user (instead resorting to looking at aspects of the markup not visible to a user, making the test less relevant).

To Reproduce
Steps to reproduce the behavior:

  1. Go to any page
  2. Click on the user avatar to visit the user page
  3. Click on the Preferences tab
  4. Click on the text "Auto follow comment threads"
  5. See that its checkbox does not change
    The same appears to be the case for other checkboxes too.

Expected behavior
Every checkbox should have a label associated with it. See <label>: The Label element on MDN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: accessibilityBugs/changes that affect accessibility. Other areas may also apply.area: frontendChanges to front-end codecomplexity: unassessedNeeds further developer investigation before complexity/feasibility can be determined.priority: medium

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions