From c191e2e84c3c52f886e772f8b2a4c7efaaa690d1 Mon Sep 17 00:00:00 2001 From: Jeff Atwood Date: Tue, 21 Feb 2017 16:25:46 -0800 Subject: [PATCH] more conservative editor heights on iOS --- .../discourse/lib/safari-hacks.js.es6 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 index 8c4e53b83ab..7d0042d98e2 100644 --- a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 +++ b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 @@ -7,18 +7,14 @@ export function isAppleDevice() { } +// we can't tell what the actual visible window height is +// because we cannot account for the height of the mobile keyboard +// and any other mobile autocomplete UI that may appear +// so let's be conservative here rather than trying to max out every +// available pixel of height for the editor function calcHeight(composingTopic) { const winHeight = window.innerHeight; - - // Hard code some known iOS resolutions - switch(winHeight) { - case 460: return composingTopic ? 250 : 260; - case 559: return composingTopic ? 325 : 308; - case 627: - case 628: return 360; - } - - const ratio = composingTopic ? 0.54 : 0.6; + const ratio = composingTopic ? 0.44 : 0.5; const min = composingTopic ? 300 : 350; return Math.max(parseInt(winHeight*ratio), min); }