-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I deploy to Vercel / Next 13 and I change routes to a page I get "DOMException: Failed to execute 'showModal' on 'HTMLDialogElement': The element is not in a Document." #429
Comments
just in addition on initial home page load with a component that has in it is not in the html tree. When it is refreshed and visited through another route it appears.
This is does not happen in development mode only production / npm start. |
Hi, @kizeesmack, and I'm sorry you're having issues. Are you saying that when the page is loaded, you are immediately trying to zoom the image (which opens the modal dialog), but the error occurs? It would be immensely helpful if you could share a functioning example that reproduces the issue. That saves me from trying to guess exactly what you're doing, and it will let us figure this out faster. |
Running into this issue as well @rpearce, but it looks like it happens intermittently. Will try to see if I can figure out why it's happening |
Here are a few examples for reference: It looks like if you navigate to a page via CleanShot.2023-08-02.at.12.02.21.mp4 |
@steven-tey Do you have the time to create an example project that demonstrates the issue? My spouse's health issues are extremely bad today, but if I've got someplace small to start, I can start looking at it tonight. |
Made a minimal repro here: https://rmiz-bug.vercel.app/ Code: https://github.com/uncurated-tests/rmiz-bug It seems to work correctly though so I'm going to keep investigating to see what's causing this issue! |
Yes, something tiny that demonstrates the issue will probably mean a quick fix! |
Ahhh I figured it out! This happens when you use
Made a minimal repro here: https://rmiz-bug.vercel.app/ (code) Reproduction steps:
CleanShot.2023-08-02.at.19.10.01.mp4Changing the runtime to This looks more of a Next.js bug so I've surfaced this to the Next.js team – we're looking into it! |
Ok, that's a great investigation and breakdown. Please let me know if something needs adjusting over on this side. |
Hi @steven-tey , have you found a solution? I am facing the same issue |
Can confirm, facing the same issue with nextjs |
@ronald-das The documentation for Next.js is not open source. |
@kizeesmack are you possibly using this via MDX? If so, try adding https://github.com/remarkjs/remark-unwrap-images as a I was getting the same error during Hello
![](/foo.webp)
That image was getting wrapped in a P tag and I was seeing hydration mismatches I installed that remark plugin, hydration errors went away, and I didn't get the Zoom error anymore. 🎉 As an aside, you can also see on https://nextjs.org/docs/app/building-your-application/rendering that the images ( Also, whats up @steven-tey 👋 😄 |
Y'all feel free to submit a PR if you think you know how to solve it on this side (as opposed to a possible bug in Next.js, as mentioned above). |
Have there been any updates on the Vercel side about this? |
Seeing the same error, "next": "14.0.4", |
If someone can provide an example repo of this breaking, I'll re-investigate to see what can be done on this side. 🙏 |
When I use Astro with View Transitions, I encounter the same problem. After looking at the source code, I found that react-medium-image-zoom/source/Controlled.tsx Lines 31 to 37 in bf6af76
react-medium-image-zoom/source/Controlled.tsx Lines 304 to 322 in bf6af76
|
@u3u Do these frameworks remove everything within the |
Screen.Recording.2024-01-13.at.21.26.13.mov@rpearce Yes, change pages in Astro will rebuild the content within all In the Next.js framework, although the content in const Zoom = dynamic(() => import('react-medium-image-zoom'), { ssr: false }) |
@u3u Thank you for the recording and the explanation. This all makes sense to me, and we'll get this issue resolved today or tomorrow! |
This issue should now be resolved in @kizeesmack @thiskevinwang @u3u @tszhong0411 — All of you have been added as project contributors in the README thanks to your bug identification, helpfulness, and code delivery. Thank you so much for your help. |
When the page is refreshed the modal works. When the page is visited through a link it does not work and the error comes up.
"DOMException: Failed to execute 'showModal' on 'HTMLDialogElement': The element is not in a Document."
Steps to reproduce / narrow test
using React latest 18+ and Next js 13 app directory
The text was updated successfully, but these errors were encountered: