Skip to content

Instantly share code, notes, and snippets.

@philipp-spiess
Last active September 22, 2019 08:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipp-spiess/a30b1610461f4306190c48f42ed70ddd to your computer and use it in GitHub Desktop.
Save philipp-spiess/a30b1610461f4306190c48f42ed70ddd to your computer and use it in GitHub Desktop.
Safari Zoom Issue
// "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