Fix Sidebar resizing handler propagation

Summary: SidebarInteractiveContainer sets mousedown/mouseup handlers. Whenever user tries to select text in child element those are triggered.

Reviewed By: passy

Differential Revision: D37994014

fbshipit-source-id: 5dcf5642b3a92ec50008aa4aad6b9522a09c1527
This commit is contained in:
Andrey Goncharov
2022-07-20 06:01:10 -07:00
committed by Facebook GitHub Bot
parent 88bf980b8e
commit f3cb9de5c9

View File

@@ -198,9 +198,16 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
gutterWidth={gutter ? theme.space.large : undefined}>
<SidebarContainer position={position} unstyled={gutter}>
{gutter ? (
<GutterWrapper position={position}>{children}</GutterWrapper>
<GutterWrapper position={position}>
{/* Stop propagating mousedown events to prevent SidebarInteractiveContainer from resizing whenever a user starts selecting text in a child */}
<Layout.Container onMouseDown={(e) => e.stopPropagation()}>
{children}
</Layout.Container>
</GutterWrapper>
) : (
children
<Layout.Container onMouseDown={(e) => e.stopPropagation()}>
{children}
</Layout.Container>
)}
</SidebarContainer>
</SidebarInteractiveContainer>