From 22f11efad07a09d5efd3bcbf8c5df78b70e845c3 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 28 Apr 2020 14:28:16 -0400 Subject: [PATCH] DEV: Replace setTimeout with Ember.run.later Followup to 6fad0463 --- app/assets/javascripts/discourse/app/lib/safari-hacks.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/safari-hacks.js b/app/assets/javascripts/discourse/app/lib/safari-hacks.js index bb094081fd7..70c3cadf4d8 100644 --- a/app/assets/javascripts/discourse/app/lib/safari-hacks.js +++ b/app/assets/javascripts/discourse/app/lib/safari-hacks.js @@ -174,14 +174,12 @@ function positioningWorkaround($fixedElement) { // this tricks iOS safari into assuming input/textarea 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(-400px)"; - setTimeout(function() { - _this.style.transform = "none"; - }, 30); + later(() => (_this.style.transform = "none"), 30); } let delay = caps.isIpadOS ? 350 : 150; - setTimeout(function() { + later(function() { if (caps.isIpadOS && iOSWithVisualViewport()) { // disable hacks when using a hardware keyboard // by default, a hardware keyboard will show the keyboard accessory bar