From 3a2c8da0a1e2140555d25301b04fdcda28e2176b Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Mon, 17 Dec 2018 17:05:41 +0000 Subject: [PATCH] Preventing zoom in iOS Safari. (#395) --- src/components/App/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index 962d72bd6..8ef731d51 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -62,6 +62,14 @@ export default class App extends Component { }; } + // Since iOS 10, Apple tries to prevent disabling pinch-zoom. This is great in theory, but + // really breaks things on Squoosh, as you can easily end up zooming the UI when you mean to + // zoom the image. Once you've done this, it's really difficult to undo. Anyway, this seems to + // prevent it. + document.body.addEventListener('gesturestart', (event) => { + event.preventDefault(); + }); + window.addEventListener('popstate', this.onPopState); }