fix: make nav controller more universal
This commit is contained in:
+4
@@ -21,7 +21,10 @@ export default class extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expandedValueChanged(expanded) {
|
expandedValueChanged(expanded) {
|
||||||
|
if (this.hasButtonTarget) {
|
||||||
this.buttonTarget.setAttribute('aria-expanded', expanded)
|
this.buttonTarget.setAttribute('aria-expanded', expanded)
|
||||||
|
}
|
||||||
|
if (this.hasSubnavTarget) {
|
||||||
this.subnavTarget.setAttribute('aria-hidden', !expanded)
|
this.subnavTarget.setAttribute('aria-hidden', !expanded)
|
||||||
if (true === expanded) {
|
if (true === expanded) {
|
||||||
this.subnavTarget.classList.remove(...this.hiddenClasses)
|
this.subnavTarget.classList.remove(...this.hiddenClasses)
|
||||||
@@ -29,4 +32,5 @@ export default class extends Controller {
|
|||||||
this.subnavTarget.classList.add(...this.hiddenClasses)
|
this.subnavTarget.classList.add(...this.hiddenClasses)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user