Skip to content

Commit

Permalink
Login and Registration: Add descriptive h1 on login screens.
Browse files Browse the repository at this point in the history
Add an `h1` heading with the existing `login_header()` text string on each view of the login screen. Mark the existing `h1`, used to wrap the WordPress logo, with `role="presentation"`, to remove it from the headings hierarchy.

Props roytanck, joedolson, ryokuhi, sabernhardt, pamprn, nagpai, mukesh27.
Fixes #51786.

git-svn-id: https://develop.svn.wordpress.org/trunk@59138 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
joedolson committed Sep 30, 2024
1 parent 3bb411e commit 891a774
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/wp-admin/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ p {
margin: 1.1em 0;
}

.login h1.admin-email__heading {
.login .admin-email__heading {
border-bottom: 1px #f0f0f1 solid;
color: #50575e;
font-weight: normal;
Expand Down Expand Up @@ -269,11 +269,11 @@ p {
vertical-align: baseline;
}

.login h1 {
.login .wp-login-logo {
text-align: center;
}

.login h1 a {
.login .wp-login-logo a {
background-image: url(../images/w-logo-blue.png?ver=20131202);
background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
background-size: 84px;
Expand Down Expand Up @@ -323,13 +323,13 @@ p {

.login #nav a:hover,
.login #backtoblog a:hover,
.login h1 a:hover {
.login .wp-login-logo a:hover {
color: #135e96;
}

.login #nav a:focus,
.login #backtoblog a:focus,
.login h1 a:focus {
.login .wp-login-logo a:focus {
color: #043959;
}

Expand Down Expand Up @@ -390,7 +390,7 @@ body.interim-login {
margin: 5px auto 20px;
}

.interim-login.login h1 a {
.interim-login.login .wp-login-logo a {
width: auto;
}

Expand Down
11 changes: 9 additions & 2 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,16 @@ function login_header( $title = null, $message = '', $wp_error = null ) {
* @since 4.6.0
*/
do_action( 'login_header' );

?>
<?php
if ( 'confirm_admin_email' !== $action && ! empty( $title ) ) :
?>
<h1 class="screen-reader-text"><?php echo $title; ?></h1>
<?php
endif;
?>
<div id="login">
<h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>
<h1 role="presentation" class="wp-login-logo"><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>
<?php
/**
* Filters the message to display above the login form.
Expand Down Expand Up @@ -420,6 +426,7 @@ function login_footer( $input_id = '' ) {
</div>
<?php } ?>
<?php } ?>

<?php

if ( ! empty( $input_id ) ) {
Expand Down

0 comments on commit 891a774

Please sign in to comment.