[wp-trac] [WordPress Trac] #40462: Add placeholders to wp_login_form()

WordPress Trac noreply at wordpress.org
Mon Oct 2 17:52:40 UTC 2017


#40462: Add placeholders to wp_login_form()
------------------------------------+--------------------------------------
 Reporter:  ramiy                   |       Owner:  voldemortensen
     Type:  enhancement             |      Status:  accepted
 Priority:  normal                  |   Milestone:  4.9
Component:  Login and Registration  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch commit        |     Focuses:  accessibility, template
------------------------------------+--------------------------------------

Comment (by ramiy):

 @joedolson If we concern placeholder will be used as a label substitute,
 we can add two more $arg to control the label `class` attribute, this way
 developers can "hide" the label with `screen-reader-text` class but
 kipping them visible for screen readers.

 {{{#!php
 wp_login_form( array(
         'label_username'       => __( 'Email Address' ),
         'label_password'       => __( 'Password' ),
         'label_class_username' => 'screen-reader-text',
         'label_class_password' => 'screen-reader-text',
         'placeholder_username' => __( 'Your username...' ),
         'placeholder_password' => __( 'Your password...' )
 ) );
 }}}

 Also, we can publish a post in https://make.wordpress.org/accessibility/
 talking about "Accessibility best practices when using login forms",
 describing how to "safely" replace labels with placeholders using `screen-
 reader-text` class. It's an educational approach.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40462#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list