- Just width=device-width Is Preferable
In regard to my assertion that initial-scale=1 is no longer a necessary default, some people complained that in its absence a page which would otherwise horizontally extend beyond the viewport will be scaled so that the document’s full width fits the width of the viewport.
If initial-scale=1 comes into play, then your site is already broken. With or without initial-scale=1, you’re failing multiple WCAG criterion. Most obviously, 1.4.10 Reflow. You need to fix this problem urgently. Regardless of how you feel about positive fallbacks in behaviour, content overextending horizontally requires fixing. It is also a major usability failing for all users either way. With that in mind, I additionally think that omitting initial-scale=1 is preferable in the case that an overflow does reach production (which, as we have established, it mustn’t) because:
- It makes horizontal overflows much more obvious and thus more likely to be noticed and fixed. Including
initial-scale=1to mask the issue disincentivises fixing the actual root cause. Beyond being more obvious to people, it is also more likely to be caught by visual regression testing. - With
initial-scale=1you risk having content off-screen which cannot be focused by a keyboard, which fails under WCAG 2.1.1 Keyboard. - It provides a better user experience. Horizontal scrolling in general (such as is required by
initial-scale=1) is an uncommon interface pattern, and horizontal overflows are even more uncommon due to being unintended. A user is extremely unlikely to think to scroll horizontally to see the rest of a document. However, what is a common pattern is zooming in and panning. People will zoom in and pan around images, PDFs, and the likes. It is a familiar pattern, unlike scrolling horizontally on a page that otherwise seems scaled to the device. There is even great precedent for it with documents on the web, given that desktop-only sites are zoomed in upon and panned around in this way. - It doesn’t hide content. When content on a page horizontally overflows, you cannot see what has overflown until you act to scroll over to it or zoom out to see the full picture. Without
initial-scale=1the user is shown the full content with the ability to zoom in on what they were actually trying to access. - People often pair
initial-scale=1withoverflow-x: hiddenin their CSS, which makes any content overflowing completely unreachable. Not having it as a default avoids walking into this trap.
Regardless, initial-scale=1 doesn’t make sense to include as a default for a case that should never reach production and which is an obvious issue. If one does decide they really want to include it, then they can, but that should be a conscious choice and not the result of tradition.