If you’re working with Divi and running a PageSpeed Insights test, you may have noticed this accessibility warning:
[user-scalable="no"] is used in the <meta name="viewport"> element or the [maximum-scale] attribute is less than 5.
This basically means that the site is preventing users from zooming properly on mobile devices, which is not great for accessibility. Luckily, the fix is simple!
Just add the following snippet to your functions.php file (or a child theme):
add_action('after_setup_theme', 'db_remove_et_viewport_meta');
add_action('wp_head', 'db_enable_pinch_zoom');
function db_remove_et_viewport_meta() {
remove_action('wp_head', 'et_add_viewport_meta');
}
function db_enable_pinch_zoom() {
echo '<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0">';
}
That’s it! With this small tweak, you’ll make your site more accessible, improve user experience, and get rid of that pesky PageSpeed Insights warning.
Leave a Reply