fix(ui): Simplify sidebar initialization logic

Replace redundant conditional blocks with single if-else statement and
move resize listener outside viewport check. Changes width threshold
from `>` to `>=` for consistency with standard breakpoint behavior.

Fixes #22930
This commit is contained in:
Martin Hauser 2026-08-20 15:03:46 +02:00 committed by Jeremy Stretch
parent 58ac88bc51
commit b6cc7d811f
3 changed files with 10 additions and 15 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -76,22 +76,17 @@ class SideNav {
toggler.addEventListener('click', event => this.onMobileToggle(event));
}
if (window.innerWidth > 1200) {
if (window.innerWidth >= 1200) {
if (this.state.get('pinned')) {
this.pin();
}
if (!this.state.get('pinned')) {
} else {
this.unpin();
}
window.addEventListener('resize', () => this.onResize());
}
if (window.innerWidth < 1200) {
} else {
this.bodyRemove('hide');
this.bodyAdd('hidden');
window.addEventListener('resize', () => this.onResize());
}
window.addEventListener('resize', () => this.onResize());
this.base.addEventListener('mouseenter', () => this.onEnter());
this.base.addEventListener('mouseleave', () => this.onLeave());