NextJS@16.0.0 applies "display: none !important;" to previous page on navigation
Unanswered
Pacific sand lance posted this in #help-forum
Pacific sand lanceOP
While navigating, previous page content stays in DOM, but has "display: none !important;" applied. Is there any way to prevent it? As of now it breaks navigation associated with shadcn/radix-ui components - while navigating from "/" to "/auth" where Sheet is mounted on "/", but not on "/auth" it starts exit animation and fails. After that radix portal with Sheet/Dialog content stays rendered and is not interactive. Same happens when i put
minimal reproduction:
assume code of
assume code of
Link from next/link within tooltip (as children of <TooltipTrigger asChild>) - tooltip content stays mounted. minimal reproduction:
assume code of
/src/app/page.tsx is:import Link from "next/link";
import { Button } from "@acme/ui/components/button";
import {
Sheet,
SheetClose,
SheetContent,
SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@acme/ui/components/sheet";
export default function Page() {
return (
<Sheet>
<SheetTrigger asChild>
<Button aria-label="Open navigation" size="icon" variant="outline">
<Menu />
</Button>
</SheetTrigger>
<SheetContent side="left">
<SheetHeader>
<SheetClose asChild>
<Link className="w-fit" href="/">
<SheetTitle>placeholder</SheetTitle>
</Link>
</SheetClose>
<SheetDescription>placeholder</SheetDescription>
</SheetHeader>
{[{ children: "auth", href: "/auth" }, { children: "some page", href: "/some-page" }].map((entry) => (
<SheetClose key={entry.href} asChild>
<Button className="mx-2 justify-start" variant="ghost" asChild>
<Link {...entry} />
</Button>
</SheetClose>
))}
</SheetContent>
</Sheet>
);
}assume code of
/src/app/auth/page.tsx is:export default function Page() {
return <p>Lorem ipsum</p>;
}7 Replies
Pacific sand lanceOP
While navigation from
Internal Sheet state indicates that it's being correctly closed. this issue happens only with nextjs16 + cachedComponents, while using exact same code with react+vite everything is working fine.
/ to /auth I expect sheet content to be unmounted/removed from DOM, but it stays here.Internal Sheet state indicates that it's being correctly closed. this issue happens only with nextjs16 + cachedComponents, while using exact same code with react+vite everything is working fine.
I assume it's something with nextjs/new
Activity componentIs there any known workaround?
Pacific sand lanceOP
related ig
this new next16 stuff really breaks a lot of animations 😭
do you have a video of it? would be nice to see how the bug looks like 👀