Skip to content

Commit

Permalink
General: Add missing initial-scale value in viewport meta tags.
Browse files Browse the repository at this point in the history
The viewport meta should include `initial-scale=1.0` to ensure that high DPI/mobile display works as expected.

References:
* [https://css-tricks.com/probably-use-initial-scale1/ CSS-Tricks: Probably Use initial-scale=1]
* [https://www.sitepoint.com/community/t/is-it-necessary-to-include-initial-scale-1-0-in-the-meta-viewport-tag/455119 SitePoint Forums: Is it necessary to include initial-scale=1.0 in the meta viewport tag?]

Follow-up to [59026].

Props dhruvang21, sabernhardt, kkmuffme, mukesh27, narenin, swissspidy, SergeyBiryukov.
Fixes #61988.

git-svn-id: https://develop.svn.wordpress.org/trunk@59027 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Sep 17, 2024
1 parent 8b8fb62 commit 7dad836
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function display_header( $body_classes = '' ) {
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/maint/repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress &rsaquo; Database Repair' ); ?></title>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/setup-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function setup_config_display_header( $body_classes = array() ) {
<!DOCTYPE html>
<html<?php echo $dir_attr; ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3868,7 +3868,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
<html <?php echo $dir_attr; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $parsed_args['charset']; ?>" />
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
if ( function_exists( 'wp_robots' ) && function_exists( 'wp_robots_no_robots' ) && function_exists( 'add_filter' ) ) {
add_filter( 'wp_robots', 'wp_robots_no_robots' );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ function wp_shake_js() {
*/
function wp_login_viewport_meta() {
?>
<meta name="viewport" content="width=device-width" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php
}

Expand Down

0 comments on commit 7dad836

Please sign in to comment.