Repository navigation
Replies: 2 comments
|
|
Great catch! Hardcoding inside breaks the headless primitive expectation when developers set modal={false} to allow background interaction. Recommended Fix // 1. Export SheetOverlay independently
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
const modal = React.useContext(SheetModalContext);
if (!modal) return null;
return (
<SheetPrimitive.Backdrop
data-slot="sheet-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
className,
)}
{...props}
/>
);
}
// 2. Export SheetOverlay in module exports
export {
Sheet,
SheetTrigger,
SheetClose,
SheetPortal,
SheetOverlay,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
};Why this approach works best: If this recommendation helps, please consider marking it as the answer! |
Uh oh!
There was an error while loading. Please reload this page.
The current Sheet template hardcodes directly inside . This breaks the underlying Base UI/Radix headless API contract.When passing modal={false} to , the focus trapping and scroll locking are correctly disabled, but the visual backdrop remains forced on the screen. A non-modal panel shouldn't obscure the background layout it is supposed to let you interact with.Proposed Fix:Either export SheetOverlay independently so it can be optionally composed inside the root layout, or pass a conditional flag (like hideOverlay) down to the content component.
All reactions