Skip to content

Commit

Permalink
fix: handle scroll to header in tabset hidden tab
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Dec 18, 2021
1 parent 5d3e814 commit e79e591
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client/themes/default/components/tabset.vue
Expand Up @@ -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)
Expand Down

0 comments on commit e79e591

Please sign in to comment.