fix(web): fix native scrollbar being intercepted by sidebar rail on windows and linux#618
Conversation
…apsed the rail's 16px hit area at z-20 sits right where the native os scrollbar lives when the sidebar is in offcanvas mode and collapsed. this causes clicks and drags on the scrollbar to toggle the sidebar instead on windows and linux. scoping pointer-events-none to [data-collapsible=offcanvas][data-state=collapsed] fixes the interception without affecting icon mode where the rail needs to stay clickable.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Tested this on Windows against the Before this change, trying to drag the chat history scrollbar could hit the collapsed sidebar rail instead and open/toggle the sidebar. With this branch applied, the scrollbar is draggable normally again. I can confirm the Windows fix. I have not tested Linux. |
…indows and linux (pingdotgg#618) the rail's 16px hit area at z-20 sits right where the native os scrollbar lives when the sidebar is in offcanvas mode and collapsed. this causes clicks and drags on the scrollbar to toggle the sidebar instead on windows and linux. scoping pointer-events-none to [data-collapsible=offcanvas][data-state=collapsed] fixes the interception without affecting icon mode where the rail needs to stay clickable.
fixes #548
the sidebar rail is a 16px wide invisible button sitting at z-20 along the
edge of the sidebar. when the sidebar is offcanvas and collapsed, that hit
area ends up exactly where the native os scrollbar lives, so clicks and drags
on the scrollbar were toggling the sidebar instead.
one css class added to SidebarRail:
[[data-collapsible=offcanvas][data-state=collapsed]_&]:pointer-events-none
scoped to offcanvas+collapsed only so icon mode (where the rail stays visible
and needs to be clickable to expand) is completely unaffected.
Note
Prevent sidebar rail button from intercepting native scrollbar on Windows and Linux by applying
pointer-events-nonewhenSidebarRailis offcanvas and collapsed in sidebar.tsxAdd a state-selective
pointer-events-noneto theSidebarRailbutton whendata-collapsible=offcanvasanddata-state=collapsedin sidebar.tsx; include an inline comment documenting the condition.📍Where to Start
Start with the
SidebarRailcomponent’s buttonclassNamelogic in sidebar.tsx.Macroscope summarized 5d3d46c.