-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove initial-scale=1.0 from meta viewport #824
Comments
Would be nice to know what the result of removal is in android devices. |
If you're using Unless someone can shed any more light as to why this property was included to begin with? |
There was a fair bit of testing that went into this line of code, and I've seen presentations by Opera staff that also recommended it. When using it, you just have to accept the orientation bug in mobile Safari for now. If you remove |
Works fine here without I'd be interested to see the original test results, perhaps time to consider a review? :) |
What about differences based on device pixel density? |
With the exception of using Edit - testing different screen densities on Opera Mobile Emulator, does not seem to cause any problems, as far as I can tell. |
Ping @mathiasbynens @shichuan Also, our documentation on this seems non-existant. So whatever happens, the code needs better reasoning in the wiki. |
Done some quick tests in Firefox Mobile (nighties) - omitting |
Here's an old google doc on the reasons for the current code, not sure if it helps much: https://docs.google.com/present/view?id=dkx3qtm_22dxsrgcf4 |
From the google doc:
I think this needs more clarification. Browsers will zoom the page to fit the viewport automatically when using Can anyone supply details on which platforms |
I suspect that was meant to say "default scaling" rather than "user scaling" |
I found this useful info on Android dev site (been updated since I last viewed it)
So, there are scenarios when the implied initial zoom may not be 1.0. But for a flexible, mobile-first or responsive design approach, does this carry weight to still need it? I'm not sure, but I think given the effect it has on iOS by its inclusion, it is worth giving some more thought. URL: http://developer.android.com/guide/webapps/targeting.html |
I've just got an Android test device running 2.3 (Gingerbread) and leaving out initial-scale doesn't seem to cause any issues on either the stock browser, Opera Mobile or Opera Mini. |
Sounds like we can drop this as Alex mentioned? Anyone has objections? |
Waiting for @mathiasbynens @shichuan input |
+1 to what @alexgibson said; I never use |
Ok since there seems to be no arguments or compelling evidence in favour of keeping the |
Hey, sorry I’m late to this—removing |
Was it tested on Android devices of different resolutions? 320x240 or 480x800 for example? |
Jonathan Neal is working on some comprehensive tests and will report back when he's done |
Good stuff - I only have a single Android device (aside from the emulators). More devices tested the better. |
I have tested on iOS5, after removing |
Here's some data @jonathantneal has managed to collect so far (he said some of it may need to be rechecked) https://gist.github.com/1410787 You can help add to it by recording your results from the test pages here: |
@shichuan - am unable to reproduce what you describe here on iOS5? If anything, the inclusion of initial-scale causes the undesirable jump? Removing it just causes the smooth zoom on rotation you see on regular desktop sites? Edit - if what you are describing as undesirable is the OS default zoom - this is the built-in browser behaviour. The same happens with desktop sites - you rotate to zoom in & read. I don't think we should be changing this given the other undesirable effects it produces. |
@alexgibson @shichuan wasn't able to reproduce the text jump here. Were there any other concerns/issues stopping us from removing |
@addyosmani The only real side effect on iOS is you don't get the full 480px of space while in landscape, but this is the same non-reflow behaviour the OS performs by default for regular desktop sites. Jeremy Keith recently posted a write up covering iOS behaviour called 'iWish' here: http://adactio.com/journal/5088/ If Apple fixed this as per Jeremy's suggestion it would be great. But currently I feel keeping initial-scale in the meta viewport degrades the iOS user experience considerably, and the JS fix introduces its own bugs that makes pinch/zoom unresponsive. If removing the initial-scale property does not have any adverse side effects on other platforms, I vote for removing the property. |
You might still need initial scale in certain situations where pixel precision is necessary. For instance, if you have a div with fixed width and height and you apply a background color and background image with the same dimensions to it, the background color might still bleed 1px through the edges on iDevices. Adding initial-scale=1 fixes the issue |
You can circumvent the zoom on rotation "bug" by adding maximum-scale=1.0 with the initial-scale=1.0. This however has the side-effect that you can no longer zoom in to a page which may be an accessibility problem. |
I think there probably needs to be better documentation on this. As has been mentioned, in some cases, the default zooming may be undesirable. In my case, I spent a good while trying to figure out why the text size was increasing in landscape. Initially I thought I was fine with just width=device-width and -webkit-text-size-adjust:100% but just happened to stumble upon the fix because I didn't really know what was wrong. Explicitly outlining the two behaviors in the docs would be helpful. |
Feel free to modify the relevant wiki page or share what you'd like to be included. |
I don't think I have enough background information on the behavior of other mobile browsers (my issue was with Mobile Safari), but something like the following would be nice to add to the mobile viewport section on this page https://github.com/h5bp/html5-boilerplate/wiki/html As is, this meta tag will allow the mobile browser's default behavior of increasing the text size on orientation change from portrait to landscape. If you wish to prevent this behavior and force the same text size for both orientations, use
but note that Mobile Safari contains a scaling bug when changing from portrait to landscape. For more information, read this article. |
Hasn't these issues been fixed, and therefore the inclusion of initial scale is important now? |
Turning the whole issue upside down: http://blog.goetter.fr/post/32513655620/viewport-adieu-width-device-width and http://www.quirksmode.org/blog/archives/2013/10/initialscale1_m.html <meta name="viewport" content="initial-scale=1"> |
The inclusion of the property initial-scale=1.0 in the meta viewport causes the zoom on rotation "bug" to happen on iOS devices. If you remove this property, the bug does not occur and the OS performs it's system default zoom on rotation.
I vote for removing this property as default on the mobile boilerplate because:
1.) it means messy JS hacks like the meta viewport JS fix are not needed.
2.) we stop seeing lots of sites that either a.) break on rotate/zoom b.) fail to pinch/zoom until the second gesture occurs
3.) it lets iOS perform it's default system behaviour, keeping in-line with user expectations.
Until there is a better fix I just see the current defaults causing more trouble than they're worth?
Just some food for thought.
P.S - I also opened this issue on the MPB, but then thought it could more appropriate here (https://github.com/shichuan/mobile-html5-boilerplate/issues/67)
The text was updated successfully, but these errors were encountered: