From e79e591f9e3268089fbf4029876c6cedb26a2055 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Fri, 17 Dec 2021 23:21:08 -0500 Subject: [PATCH] fix: handle scroll to header in tabset hidden tab --- client/themes/default/components/tabset.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/themes/default/components/tabset.vue b/client/themes/default/components/tabset.vue index 0b240c70..19d2128e 100644 --- a/client/themes/default/components/tabset.vue +++ b/client/themes/default/components/tabset.vue @@ -37,7 +37,22 @@ export default { } }, mounted () { + // Handle scroll to header on load within hidden tab content + if (window.location.hash && window.location.hash.length > 1) { + const headerId = decodeURIComponent(window.location.hash) + let foundIdx = -1 + this.$refs.content.childNodes.forEach((node, idx) => { + if (node.querySelector(headerId)) { + foundIdx = idx + } + }) + if (foundIdx >= 0) { + this.currentTab = foundIdx + } + } + this.setActiveTab() + this.$refs.tabs.childNodes.forEach((node, idx) => { node.addEventListener('click', ev => { this.currentTab = [].indexOf.call(ev.target.parentNode.children, ev.target)