From fe7883eeeab6872f68e072063ce95116b389f85a Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 15 Sep 2016 07:36:16 +1000 Subject: [PATCH] UX: don't allow user scaling in mobile view on iOS 10 behavior of zoom restriction has changed. This does not disable zooming on iOS 10 but it DOES stop it from randomly zooming when you are composing --- app/assets/javascripts/discourse/lib/mobile.js.es6 | 12 ++++++++++++ app/views/layouts/_head.html.erb | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/app/assets/javascripts/discourse/lib/mobile.js.es6 b/app/assets/javascripts/discourse/lib/mobile.js.es6 index ef2d07bbf..940e18c44 100644 --- a/app/assets/javascripts/discourse/lib/mobile.js.es6 +++ b/app/assets/javascripts/discourse/lib/mobile.js.es6 @@ -29,6 +29,18 @@ const Mobile = { // localStorage may be disabled, just skip this // you get security errors if it is disabled } + + // Sam: I tried this to disable zooming on iOS 10 but it is not consistent + // you can still sometimes trigger zoom and be stuck in a horrible state + // + // let iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); + // if (iOS) { + // document.documentElement.addEventListener('touchstart', function (event) { + // if (event.touches.length > 1) { + // event.preventDefault(); + // } + // }, false); + // } }, toggleMobileView() { diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index 6a5ab0ee6..c81db33c8 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -10,7 +10,11 @@ <%- end %> +<% if mobile_view? %> + +<% else %> +<% end %> <%= canonical_link_tag %> <%= render_sitelinks_search_tag %>