Skip to content

fix(js): stop sidebar auto-reopening on page navigation - #8773

Merged
Alkarex merged 1 commit into
FreshRSS:edgefrom
polybjorn:fix/sidebar-reopens-on-nav
May 3, 2026
Merged

Alkarex merged 1 commit into
FreshRSS:edgefrom
polybjorn:fix/sidebar-reopens-on-nav

Conversation

@polybjorn

@polybjorn polybjorn commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #8771. My earlier #8747 broke this: at narrow viewports the sidebar re-opens by itself when navigating (e.g. clicking the logo) on sessions where it was previously closed.

That PR removed an inline aside.style.display = 'none' from the sidebar close path. A check further down in init_nav_menu() was implicitly relying on it to detect "sidebar is currently hidden":

if (getComputedStyle(aside).display !== 'none') { ... aside.classList.add('visible') ... }

At narrow viewports aside's computed display stays table-cell after a close (the narrow @media hides via width: 0, not display), so the check now always passes and re-adds .visible.

Fix

Gate on toggle_aside.classList.contains('active') instead, the actual source of truth for whether the sidebar should be open.

After #8747 the sidebar would re-open on its own when navigating
(e.g. clicking the logo) on sessions where sessionStorage said
the sidebar should be closed.

init_nav_menu() ran toggle_aside_click() to honour the stored
state, then gated a follow-up `.visible` re-add on
`getComputedStyle(aside).display !== 'none'`. Before #8747 that
gate worked because the close path set `aside.style.display =
'none'` inline; #8747 replaced that with an `is-hidden` class
applied only at wide viewports, so at narrow viewports the
computed display stays `table-cell` after closing and the gate
wrongly re-adds `.visible`, sliding the drawer open.

Gate on the toggle button's `.active` state instead. It's the
real source of truth for "should the sidebar be open" and is
already used elsewhere in the same function.

Fixes #8771
@Alkarex Alkarex added this to the 1.29.0 milestone May 3, 2026
@Alkarex Alkarex added UI 🎨 User Interfaces Bug (confirmed) 🐞 issues that are reproducible labels May 3, 2026
@Alkarex
Alkarex merged commit c43930c into FreshRSS:edge May 3, 2026
1 check passed
@polybjorn
polybjorn deleted the fix/sidebar-reopens-on-nav branch May 3, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug (confirmed) 🐞 issues that are reproducible UI 🎨 User Interfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI regression: clicking logo opens sidebar

2 participants