Skip to content

Inputs missing labels & Labels missing inputs #7

@danspratling

Description

@danspratling

Proposal:

Inputs missing labels (often when Placeholders are being used as labels) might have unclear intentions.

Issue:

<input type="text" placeholder="Email" />

The placeholder in the above example is rarely read by screenreaders

Issue 2:

<label>Email</label>
<input type="text" />

The label in the above example exists, but is not associated with an element so will often be misinterpreted.

Solution:

<label for="email">Email Address</label>
<input name="email" type="text" />

The above is the best-accepted solution, which most screen readers understand (unlike <label><input></label>).

We should check 2 things

  • Does a label have a for attribute present and populated
  • Does an input have a name attribute present and populated

This won't account for if any inputs/labels have attributes present but their counterparts don't exist, however.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a11y featureNew feature or request for an a11y checkneeds more infoFurther information from author is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions