Skip to content

fix(desktop): sidebar toggle button hidden after collapse#3141

Closed
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:fix/desktop-sidebar-reopen-regression
Closed

fix(desktop): sidebar toggle button hidden after collapse#3141
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:fix/desktop-sidebar-reopen-regression

Conversation

@HUQIANTAO
Copy link
Copy Markdown
Contributor

Summary

The left rail's chevron toggle disappears the moment the rail collapses, leaving the user with no way to re-expand the sidebar. Only a full app restart (or localStorage.removeItem('reasonix.sidebar.collapsed')) could recover it.

Root cause

The collapsed-rail CSS rule

.sidebar--collapsed .sidebar__brand > span { display: none }

is too broad. The brand block is

<div className="sidebar__brand">
  <img className="sidebar__logo" />
  <span>Reasonix</span>
  <Tooltip label={...}>
    <button className="sidebar__toggle"  />
  </Tooltip>
</div>

and the Tooltip component wraps its child in a <span ref={setTriggerRef} {...triggerProps}>{children}</span> (see Tooltip.tsx). So the > span selector matched two spans — the brand text span (intended) and the Tooltip wrapper around the toggle button (unintended). Once the rail collapsed, the Tooltip wrapper got display: none, taking the toggle button with it. The rail was then a 68 px dead zone with no way out.

Regression

PR #2987 (9d3a7e7b) fixed this exact bug by adding a .sidebar__brand-name class and narrowing the selector to .sidebar--collapsed .sidebar__brand-name. That fix was reverted at some point in the main-v2 history (the class is gone, the broad > span rule is back), so the bug resurfaced.

Fix

  1. Re-apply the original fix: add sidebar__brand-name to the brand text span in App.tsx and narrow the CSS selector.

  2. Add a belt-and-suspenders defensive override

    .sidebar--collapsed .sidebar__brand .tooltip-trigger { display: inline-flex }

    so a future revert of the brand-name class (or a similar regression) cannot lock the rail closed again. The Tooltip wrapper is now explicitly visible regardless of what other rules touch the brand's spans.

  3. Comments on both sides of the change explain why the class indirection exists and link to PR fix(desktop): sidebar toggle button hidden after collapse #2987, so the next person who looks at this code sees the trap.

Files

File Change
desktop/frontend/src/App.tsx <span>Reasonix</span><span className="sidebar__brand-name">Reasonix</span> plus an inline comment.
desktop/frontend/src/styles.css Replace .sidebar--collapsed .sidebar__brand > span with the targeted .sidebar--collapsed .sidebar__brand-name, add the defensive .tooltip-trigger override, and document why.

Diff stat

desktop/frontend/src/App.tsx    |  7 ++++++-
desktop/frontend/src/styles.css | 12 +++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)

Verification

  • pnpm typecheck → clean.
  • pnpm build → clean (✓ built in 1.72s).
  • Manual: open the desktop client, click the rail toggle to collapse, confirm the PanelLeftOpen icon is still visible at the top of the rail, click it, and confirm the rail re-expands. Repeat in both themes and on both darwin and the non-darwin padding variant.
  • No new dependencies; no i18n surface change; no JS behavior change outside the CSS / brand-name class.

Regression of esengine#2987: the rule

    .sidebar--collapsed .sidebar__brand > span { display: none }

is too broad. The Tooltip component wraps its child in a <span> trigger
(Tooltip.tsx: `<span ref={setTriggerRef} {...triggerProps}>{children}</span>`),
and the toggle button lives inside that span. So once the rail
collapsed, the > span rule also hid the Tooltip wrapper, the toggle
button disappeared with it, and there was no UI left to expand the
sidebar back. Only a full app restart (or `localStorage.removeItem`
of the reasonix.sidebar.collapsed key) could recover it.

The original esengine#2987 fix introduced a dedicated .sidebar__brand-name
class and narrowed the selector, but the change was reverted at some
point (the class is gone and the > span rule is back). Re-apply the
fix, and add a belt-and-suspenders override
`.sidebar--collapsed .sidebar__brand .tooltip-trigger { display: inline-flex }`
so a future regression in the brand-name selector cannot lock the
rail closed again. Comments on both sides point at esengine#2987 so the next
person to touch this code sees why the indirection exists.
@HUQIANTAO HUQIANTAO requested a review from SivanCola as a code owner June 4, 2026 16:30
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 4, 2026
@esengine
Copy link
Copy Markdown
Owner

esengine commented Jun 5, 2026

Thanks for chasing this one down — the diagnosis (the broad .sidebar__brand > span rule also hitting the Tooltip span) was exactly right. It's since been overtaken by a refactor that moved the brand and the collapse toggle into the app-chrome header, so sidebar__brand no longer exists and the toggle can't be hidden this way. Closing as obsolete against current main-v2. Appreciate the careful write-up 🙏

@esengine esengine closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants