Skip to content

Commit

Permalink
Merge pull request #84 from sul-dlss/adjust-scope
Browse files Browse the repository at this point in the history
Broaden the scope of the selector for facet value
  • Loading branch information
corylown authored Jan 25, 2024
2 parents 83aa2ba + 4fe1151 commit eca54b4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ export default class extends Controller {
this.element.classList.add("twiddle")

// If a child facet-value is selected, then expand the node
if (this.element.querySelector(':scope > span.selected')) {
if (this.isChildSelected()) {
this.element.classList.add('twiddle-open')
this.element.querySelectorAll(':scope > .collapse')
.forEach((collapsable) => collapsable.classList.add('show'))
}
}

isChildSelected() {
return this.element.querySelector('span.selected')
}

toggle() {
this.element.classList.toggle("twiddle-open")
}
Expand Down

0 comments on commit eca54b4

Please sign in to comment.