A platform for community discussion. Free, open, simple.
FIX: Mobile Safari composer improvements (#8069)
Penar Musaraj21e5772aa5d5
diff --git a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6 b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6index fa619da659d..1c234632e7d 100644--- a/app/assets/javascripts/discourse/lib/safari-hacks.js.es6+++ b/app/assets/javascripts/discourse/lib/safari-hacks.js.es6@@ -63,7 +63,6 @@ function calcHeight() {}let workaroundActive = false;-let composingTopic = false;export function isWorkaroundActive() {return workaroundActive;@@ -129,11 +128,24 @@ function positioningWorkaround($fixedElement) {if (fixedElement.style.top === "0px") {if (this !== document.activeElement) {evt.preventDefault();++ // this tricks safari into assuming current input is at top of the viewport+ // via https://stackoverflow.com/questions/38017771/mobile-safari-prevent-scroll-page-when-focus-on-input+ this.style.transform = "translateY(-200px)";this.focus();+ let _this = this;+ setTimeout(function() {+ _this.style.transform = "none";+ }, 50);}return;}+ // don't trigger keyboard on disabled element (happens when a category is required)+ if (this.disabled) {+ return;+ }+originalScrollTop = $(window).scrollTop();// take care of body@@ -153,9 +165,7 @@ function positioningWorkaround($fixedElement) {fixedElement.style.top = "0px";- composingTopic = $("#reply-control .category-chooser").length > 0;-- const height = calcHeight(composingTopic);+ const height = calcHeight();fixedElement.style.height = height + "px";$(fixedElement).addClass("no-transition");