Skip to content

Commit

Permalink
Skip select all tabs if missing groupKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinovantes committed Aug 9, 2024
1 parent 626e05e commit 4fa7626
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Plugins/Tabs/Tabs.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,17 @@ class TabContainer extends HTMLElement {
}

/**
* Iterates all tab containers of current groupKey and selects the heading that matches current heading
*
* @param {string} selectedHeadingName
* @returns void
*/
selectTabForEveryoneElse(selectedHeadingName) {
const groupKey = this.getAttribute('ATTR_TAB_GROUP_NAME')
if (!groupKey) {
return
}

const allTabContainers = document.querySelectorAll(`ELEMENT_CONTAINER[ATTR_TAB_GROUP_NAME="${groupKey}"]`)

for (const otherContainer of allTabContainers) {
Expand All @@ -157,7 +163,7 @@ class TabContainer extends HTMLElement {
continue
}

const otherContainerHeading = otherContainer.querySelector(`ELEMENT_HEADING[ATTR_HEADING_NAME=${selectedHeadingName}]`)
const otherContainerHeading = otherContainer.querySelector(`ELEMENT_HEADING[ATTR_HEADING_NAME="${selectedHeadingName}"]`)
otherContainer.selectTab(otherContainerHeading)
}

Expand Down

0 comments on commit 4fa7626

Please sign in to comment.