Skip to content

Commit a8e36f6

Browse files
committed
fix: force-close sidebar dropdown instantly before positioning nav indicator
1 parent 95a85e9 commit a8e36f6

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

public/js/app.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,12 @@ function navigateTo(page) {
14541454
const parent = document.querySelector('#nav-servers-toggle');
14551455
const subList = document.querySelector('#nav-servers-list');
14561456
if (parent) parent.classList.remove('open');
1457-
if (subList) subList.classList.remove('open');
1457+
if (subList) {
1458+
subList.style.transition = 'none';
1459+
subList.classList.remove('open');
1460+
void subList.offsetHeight;
1461+
subList.style.transition = '';
1462+
}
14581463
}
14591464
const targetNav = document.querySelector(`.nav-item[data-page="${basePage}"]`);
14601465
if (targetNav) targetNav.classList.add('active');
@@ -1580,7 +1585,12 @@ window.addEventListener('popstate', () => {
15801585
const parent = document.querySelector('#nav-servers-toggle');
15811586
const subList = document.querySelector('#nav-servers-list');
15821587
if (parent) parent.classList.remove('open');
1583-
if (subList) subList.classList.remove('open');
1588+
if (subList) {
1589+
subList.style.transition = 'none';
1590+
subList.classList.remove('open');
1591+
void subList.offsetHeight;
1592+
subList.style.transition = '';
1593+
}
15841594
}
15851595
const targetNav = document.querySelector(`.nav-item[data-page="${basePage}"]`);
15861596
if (targetNav) targetNav.classList.add('active');

0 commit comments

Comments
 (0)