mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-03 10:13:47 +10:00
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:
@@ -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", () => {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user