From 7e18c361c798adb9c41a4c959f492631a9806639 Mon Sep 17 00:00:00 2001 From: David Holdeman Date: Fri, 24 Jun 2022 16:28:05 -0500 Subject: [PATCH] always scroll when pin is clicked (#4281) --- misc/pinout-gen/script.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/misc/pinout-gen/script.js b/misc/pinout-gen/script.js index 800349987e..e637940dc2 100644 --- a/misc/pinout-gen/script.js +++ b/misc/pinout-gen/script.js @@ -51,6 +51,12 @@ function addRow(table, pin, cid) { } function clickPin(table, pin, cid) { + var container; + for (var elem = table; elem && elem !== document; elem = elem.parentNode) { + if (elem.matches(".container")) { + container = elem; + }; + } table.parentElement.style.display = "table"; table.innerHTML = ""; addRow(table, pin, cid); @@ -75,6 +81,7 @@ function clickPin(table, pin, cid) { url.search = ""; window.history.pushState({}, "", url) } + container.scrollIntoView() } function checkparams() { var params = new URLSearchParams(window.location.search);