Skip to content

Commit df13494

Browse files
committed
Upgrade/Install: Improve accessibility of the setup-config and install pages.
- Makes the language chooser label always visible. - Adds missing `lang` attribute to the HTML element. - Makes sure `get_language_attributes()` returns correct values on the setup-config page. Props sabernhardt, joedolson, shailesh7714, afercia. Fixes #65454. git-svn-id: https://develop.svn.wordpress.org/trunk@62712 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 717e02d commit df13494

5 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/wp-admin/css/install.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,13 @@ body.language-chooser {
322322
max-width: 300px;
323323
}
324324

325+
.language-chooser [for="language"] {
326+
display: inline-block;
327+
margin-bottom: 10px;
328+
font-size: 14px;
329+
font-weight: 600;
330+
}
331+
325332
.language-chooser select {
326333
padding: 8px;
327334
width: 100%;

src/wp-admin/includes/translation-install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function wp_install_language_form( $languages ) {
205205

206206
$installed_languages = get_available_languages();
207207

208-
echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n";
208+
echo "<label for='language'>Select a default language</label>\n";
209209
echo "<select size='14' name='language' id='language'>\n";
210210
echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
211211
echo "\n";

src/wp-admin/install.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if ( false ) {
1111
?>
1212
<!DOCTYPE html>
13-
<html>
13+
<html lang="en-US">
1414
<head>
1515
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1616
<title>Error: PHP is not running</title>

src/wp-admin/setup-config.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,15 @@ function setup_config_display_header( $body_classes = array() ) {
9595
$body_classes = (array) $body_classes;
9696
$body_classes[] = 'wp-core-ui';
9797
$body_classes[] = 'admin-color-modern';
98-
$dir_attr = '';
98+
9999
if ( is_rtl() ) {
100100
$body_classes[] = 'rtl';
101-
$dir_attr = ' dir="rtl"';
102101
}
103102

104103
header( 'Content-Type: text/html; charset=utf-8' );
105104
?>
106105
<!DOCTYPE html>
107-
<html<?php echo $dir_attr; ?>>
106+
<html <?php language_attributes(); ?>>
108107
<head>
109108
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
110109
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -134,7 +133,7 @@ function setup_config_display_header( $body_classes = array() ) {
134133
$languages = wp_get_available_translations();
135134
if ( $languages ) {
136135
setup_config_display_header( 'language-chooser' );
137-
echo '<h1 class="screen-reader-text">Select a default language</h1>';
136+
echo '<h1 class="screen-reader-text">Welcome to WordPress</h1>';
138137
echo '<form id="setup" method="post" action="?step=0">';
139138
wp_install_language_form( $languages );
140139
echo '</form>';

src/wp-includes/general-template.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4546,13 +4546,16 @@ function get_language_attributes( $doctype = 'html' ) {
45464546
$attributes[] = 'dir="rtl"';
45474547
}
45484548

4549-
$lang = get_bloginfo( 'language' );
4549+
$lang = get_bloginfo( 'language' );
4550+
$html_type = get_option( 'html_type' );
4551+
45504552
if ( $lang ) {
4551-
if ( 'text/html' === get_option( 'html_type' ) || 'html' === $doctype ) {
4553+
if ( 'text/html' === $html_type || 'html' === $doctype ) {
45524554
$attributes[] = 'lang="' . esc_attr( $lang ) . '"';
45534555
}
45544556

4555-
if ( 'text/html' !== get_option( 'html_type' ) || 'xhtml' === $doctype ) {
4557+
// The $html_type option may be false on a new install on the setup-config.php page.
4558+
if ( ( $html_type && 'text/html' !== $html_type ) || 'xhtml' === $doctype ) {
45564559
$attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
45574560
}
45584561
}

0 commit comments

Comments
 (0)