fix(ui): Restrict sidebar initialization to the vertical navbar
initSideNav() matched every .navbar element, and templates/base/layout.html puts that class on both the sidebar aside and the top header, so a second SideNav was constructed for the header. Scope the selector to .navbar-vertical, which is what the pre-Tabler selector .sidenav did. Widen the sidebar element type from HTMLDivElement to HTMLElement, since the element the selector matches is an aside. Fixes #22929
This commit is contained in:
parent
6578541eee
commit
604653935c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -10,7 +10,7 @@ class SideNav {
|
|||
/**
|
||||
* Sidenav container element.
|
||||
*/
|
||||
private base: HTMLDivElement;
|
||||
private base: HTMLElement;
|
||||
|
||||
/**
|
||||
* SideNav internal state manager.
|
||||
|
|
@ -27,7 +27,7 @@ class SideNav {
|
|||
*/
|
||||
private sections: Section[] = [];
|
||||
|
||||
constructor(base: HTMLDivElement) {
|
||||
constructor(base: HTMLElement) {
|
||||
this.base = base;
|
||||
this.state = new StateManager<NavState>(
|
||||
{ pinned: true },
|
||||
|
|
@ -314,7 +314,7 @@ class SideNav {
|
|||
}
|
||||
|
||||
export function initSideNav(): void {
|
||||
for (const sidenav of getElements<HTMLDivElement>('.navbar')) {
|
||||
for (const sidenav of getElements<HTMLElement>('.navbar-vertical')) {
|
||||
new SideNav(sidenav);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue