fix(ui): let a mouse press click inside a bottom sheet

The drawer took a mouse press anywhere outside Drawer.Content as the
start of a swipe and captured the pointer, so switches and buttons in a
bottom sheet never received the click. The sheet's children now sit in
Drawer.Content; touch swipes still dismiss from anywhere.
This commit is contained in:
Amruth Pillai
2026-09-29 13:26:55 +02:00
parent e3d72ab0e7
commit 09134035a8
2 changed files with 7 additions and 3 deletions
+5 -2
View File
@@ -30,7 +30,7 @@ describe("Sheet", () => {
<SheetContent>visible</SheetContent>
</Sheet>,
);
const content = screen.getByText("visible");
const content = screen.getByText("visible").closest('[data-slot="sheet-content"]');
expect(content).toHaveAttribute("data-side", "right");
});
@@ -41,7 +41,10 @@ describe("Sheet", () => {
<SheetContent side={side}>visible {side}</SheetContent>
</Sheet>,
);
expect(screen.getByText(`visible ${side}`)).toHaveAttribute("data-side", side);
expect(screen.getByText(`visible ${side}`).closest('[data-slot="sheet-content"]')).toHaveAttribute(
"data-side",
side,
);
});
it("renders close button by default", () => {
+2 -1
View File
@@ -74,7 +74,8 @@ function SheetContent({
{side === "bottom" && (
<span aria-hidden="true" className="mx-auto block h-[5px] w-9 shrink-0 rounded-full bg-line-2" />
)}
{children}
{/* Content is where a mouse press clicks rather than starts a swipe; `contents` keeps it out of the layout. */}
<SheetPrimitive.Content className="contents">{children}</SheetPrimitive.Content>
{showCloseButton && (
<SheetPrimitive.Close
data-slot="sheet-close"