Last active
September 22, 2019 08:39
-
-
Save philipp-spiess/a30b1610461f4306190c48f42ed70ddd to your computer and use it in GitHub Desktop.
Safari Zoom Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "Reminder" for mobile Safari to not enable default user scaling. When | |
// testing a PSPDFKit release we noticed that iOS 12.4.1 on _some_ devices | |
// (iPhone X) was ignoring the user-scalable part causing it to zoom in | |
// whenever a node is focused with a below 16px font-size. | |
// | |
// We found out that updating the content meta tag's user-scalable part from | |
// 0 to no (which is equivalent and also supported on iOS) after a bit would | |
// be enough to get the desired behavior. | |
setTimeout(function() { | |
const viewport = document.querySelector('meta[name="viewport"]'); | |
viewport.content = viewport.content.replace( | |
"user-scalable=0", | |
"user-scalable=no" | |
); | |
}, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment