Skip to content

Duplicate labels used with multiple naming techniques #781

Closed
@colabottles

Description

@colabottles

Why It Matters: Page headings and labels for form and interactive controls are informative. Avoid duplicating heading and label text unless the structure provides adequate differentiation between them.

How to Fix It: Use a visually hidden CSS class to hide the text and remove the placeholder. Placeholders are not labels and some browser/screen reader combinations will read the placeholder twice.

In this approach, the <label> element is provided to identify a form control within the code, but it is visually hidden to avoid redundancy for users who can derive the purpose from the visual cues.

<label for="search" class="visuallyhidden">Search for...
    <input 
        name="searchQuery" 
        id="U0b8fb8121c3845e99ff71a95ab78d05b" 
        type="text" 
        class="text-style-body-medium _searchInput_f6v3c_118 "
    >
</label>

Success Criteria Affected:

Screenshot(s):
Screenshot of the search form

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguwuUwU

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions