Make WordPress Core

Changeset 53576


Ignore:
Timestamp:
06/24/2022 09:24:18 PM (22 months ago)
Author:
davidbaumwald
Message:

Comments: Add contextual autocomplete attributes to comment form fields.

For accessibility, input fields should identify their "purpose". The HTML5 attribute autocomplete allows for various user data to be quickly autofilled while adding context for some assistive technologies.

This commit adds the appropriate autofill purposes for an author's name, email, and website URL in the comment form template.

Props juliemoynat, bhrugesh96, sabernhardt.
Fixes #55779.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r53469 r53576  
    23722372            ),
    23732373            sprintf(
    2374                 '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245"%s />',
     2374                '<input id="author" name="author" type="text" value="%s" size="30" maxlength="245" autocomplete="name"%s />',
    23752375                esc_attr( $commenter['comment_author'] ),
    23762376                ( $req ? $required_attribute : '' )
     
    23852385            ),
    23862386            sprintf(
    2387                 '<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes"%s />',
     2387                '<input id="email" name="email" %s value="%s" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email"%s />',
    23882388                ( $html5 ? 'type="email"' : 'type="text"' ),
    23892389                esc_attr( $commenter['comment_author_email'] ),
     
    23982398            ),
    23992399            sprintf(
    2400                 '<input id="url" name="url" %s value="%s" size="30" maxlength="200" />',
     2400                '<input id="url" name="url" %s value="%s" size="30" maxlength="200" autocomplete="url" />',
    24012401                ( $html5 ? 'type="url"' : 'type="text"' ),
    24022402                esc_attr( $commenter['comment_author_url'] )
Note: See TracChangeset for help on using the changeset viewer.