From a681ebfa3fbb8b5266ff1c7300ed22ff73ef7a3c Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Tue, 6 Oct 2020 10:45:35 +0200 Subject: [PATCH 1/2] Fix chrome-only scrolling bug with GTN webhook Content is reflown upon display changes, meaning that in chrome the iframe fails to retain it's original scroll offset. This fixes it by using visibility in place of display, thus preventing a content reflow. --- config/plugins/webhooks/gtn/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/plugins/webhooks/gtn/script.js b/config/plugins/webhooks/gtn/script.js index b70527daec74..4702c1b4a45c 100644 --- a/config/plugins/webhooks/gtn/script.js +++ b/config/plugins/webhooks/gtn/script.js @@ -1,7 +1,11 @@ var gtnWebhookLoaded = false; function removeOverlay() { - document.getElementById("gtn-container").classList.add("d-none"); + document.getElementById("gtn-container").style.visibility = 'hidden'; +} + +function showOverlay() { + document.getElementById("gtn-container").style.visibility = 'visible'; } function addIframe() { @@ -105,7 +109,7 @@ elementReady("#gtn a").then((el) => { if (!gtnWebhookLoaded) { addIframe(); } else { - document.getElementById("gtn-container").classList.toggle("d-none"); + showOverlay(); } }); }); From fe4f81ef6636bcf553816e04492f3a7fa7a1bf8b Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 6 Oct 2020 10:33:03 -0400 Subject: [PATCH 2/2] Standard quotes --- config/plugins/webhooks/gtn/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/plugins/webhooks/gtn/script.js b/config/plugins/webhooks/gtn/script.js index 4702c1b4a45c..0d98fdaac031 100644 --- a/config/plugins/webhooks/gtn/script.js +++ b/config/plugins/webhooks/gtn/script.js @@ -1,11 +1,11 @@ var gtnWebhookLoaded = false; function removeOverlay() { - document.getElementById("gtn-container").style.visibility = 'hidden'; + document.getElementById("gtn-container").style.visibility = "hidden"; } function showOverlay() { - document.getElementById("gtn-container").style.visibility = 'visible'; + document.getElementById("gtn-container").style.visibility = "visible"; } function addIframe() {