Skip to content

fix(react-ui): collapsed-sidebar open button could become unreachable (reveal keyed to animation state) - #809

Merged
ankit-thesys merged 4 commits into
mainfrom
fix/sideber_icon_visibility
Jul 23, 2026
Merged

fix(react-ui): collapsed-sidebar open button could become unreachable (reveal keyed to animation state)#809
ankit-thesys merged 4 commits into
mainfrom
fix/sideber_icon_visibility

Conversation

@i-subham23

@i-subham23 i-subham23 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixes the "open sidebar icon is randomly not visible" bug and keeps the collapsed rail's logo/button hover swap.

Problem

The collapsed rail hides the open button via the header's --collapsed class (binary, driven by isCollapsedLayout), but the hover rule that reveals it keyed off [data-sidebar-visual-state="collapsed"] — a four-state animation attribute (expanded → collapsing → collapsed → expanding) advanced by chained timeouts. During the collapse animation the attribute still reads "collapsing", so hovering revealed nothing (~170ms measured on every collapse, with the button visibly fading out under the cursor); and if the timeout chain is interrupted (rapid toggling, layout switches), the attribute can strand there — a collapsed rail whose open button can never be revealed. That's the randomness.

Change

All in sidebar.scss; behavior:

  • The resting face is contextual (:has): with a logo configured, the logo is the resting face and the button appears on hover; with no logo the slot is empty, so the button stays visible at rest instead — the open control is always discoverable.
  • The reveal rule keys off .openui-agent-sidebar-container--collapsed — the same binary isCollapsedLayout state as the hiding rule, set in the same render — so hidden-but-unrevealable is impossible by construction.
  • Keyboard focus reveals the swap via :has(:focus-visible), so tabbing never lands on an invisible button. (:focus-visible rather than :focus-within, so the residual focus a mouse click leaves on the toggle doesn't pin the button over the logo at rest.)
  • @media (hover: none) shows the open button at rest on touch devices, which have no hover to trigger the swap.

Test Plan

  • Playwright probe against the openui-cloud example, with and without a logoUrl:
    • rest shows the logo (or the button when no logo is set); hover swaps, unhover swaps back
    • hovering mid-collapse-animation (the old bug window, attribute = "collapsing") keeps the button fully visible — zero dead-window samples
    • after a mouse-click collapse the rail rests on the logo (click focus doesn't pin the button)
    • Tab reveals the button and Enter expands the sidebar
    • emulated hover: none shows the button at rest
  • SCSS compiles clean; CSS artifact check passes

…eraction

- Adjusted opacity and pointer-events for the sidebar logo and toggle button to improve user interaction.
- Removed redundant hover styles for collapsed sidebar state, streamlining the CSS for better maintainability.
@i-subham23
i-subham23 requested a review from ankit-thesys July 22, 2026 07:40
@ankit-thesys ankit-thesys changed the title style(react-ui): update sidebar styles for logo and toggle button interaction fix(react-ui): collapsed-sidebar open button could become unreachable (reveal keyed to animation state) Jul 22, 2026
- Updated sidebar styles to conditionally hide the toggle button when a logo is present, improving user experience.
- Added hover styles to ensure the toggle button appears only after the collapse animation, addressing the no-logo case (TH-2392).
@i-subham23
i-subham23 force-pushed the fix/sideber_icon_visibility branch from ac55d61 to 7bbeea0 Compare July 22, 2026 10:53
i-subham23 and others added 2 commits July 22, 2026 16:24
…tton

- Removed outdated comments and streamlined the hover styles for the collapsed sidebar state.
- Ensured the toggle button visibility logic is clear and maintains user experience during collapse animations.
…oard and touch reveal

Keep the :has(logo) resting-face rule, but reveal the open button via the
binary --collapsed layout class instead of data-sidebar-visual-state — the
attribute's transitional values open a window during the collapse animation
where the button is hidden but hovering cannot reveal it. Also reveal on
keyboard focus (:has(:focus-visible), so residual click focus doesn't pin
the button over the logo) and show the button at rest on hover-less (touch)
devices via @media (hover: none).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XECS4NLhz6BNd1TUYbWjfu

@ankit-thesys ankit-thesys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@ankit-thesys
ankit-thesys merged commit 7b5175a into main Jul 23, 2026
2 checks passed
@ankit-thesys
ankit-thesys deleted the fix/sideber_icon_visibility branch July 23, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants