Extend HTML <dialog> backdrop to iPhone safe areas.
I am trying to extend dialog backdrop to iPhone safe area but no luck so far. On the image you can see the top and bottom areas don't show the backdrop. I am using nextjs and tailwind.
Code snippet:

13 Replies
Forgot to add that this appears in iOS 26
I haven't yet installed iOS 26 to be able to test but this could be due to how Apple calculates vh.
Tailwind h-screen = height: 100vh;
Have you tried using a different unit such as svh or dvh?
We can't control the size of the backdrop though, can you? Quick testing on my part, and I can confirm it's not working... might be something that needs a bug report filed.
Oh, it's just a position fixed element, so you can control it
hmm, negative inset doesnt seem to fix it though
must be with how
position: fixed works with the env safe areas or how they are defining the viewport for fixed elements or something... though a negative inset should work, but it doesn't 🤷
I changed it to position: absolute and inset: -1000vw and that works, but on desktop it causes overflow, lol.
yeah, I just tested a bunch of ways to try and pull it into the safe areas while keeping it position: fixed and nothing works.
must be related to top layer... I have another element with position fixed where a negative inset works, but the exact same declarations on the backdrop don't workIf this is a bug, where should I submit it to, webkit, safari?
i dont have a device to try this, but, have you tried to set the backdrop size to 100x100cm?
tried different height units but it seems like there is just no way to extend the dialog backdrop to the top & bottom safe areas
considering that safari got modal support a very short time ago, i get why there's these gremlins
but, can you try a simple dialog in a simple html file, with no styled at all, and see if it does the same?
just a file with
<dialog open>hi!</dialog>by default the backdrop has no background color, so had to add it
yeah, and doesnt grow past that area :/
From what I read it may have something to do with Safari Tabs.
Have you got them set to "compact" (I believe this is the default)?
Try setting to "top" or "bottom". This isn't any kind of solution, just to help identify the issue.
this would be a webkit bug. I haven't seen a bug filed on it yet. I'll get to it eventually.... unless someone here wants to first, lol.
Someone DMed me on Bluesky about the same problem yesterday, and used the NYT site as an example.
Basically,
position: fixed is now mucked, and lots of big sites have issues, so I'm guessing it'll get resolved pretty quickly, lol.
I can think of some workarounds for most things, but ::backdrop seems stuck no matter what. I think it's the top layer limiting it somehow.
I think it's even a problem on Apples site with their menu... but you don't really notice it because they jump the page to the top when you open the menu for some reason, and on other pages where an image might peek out the bottom, they don't have the sticky header like on the homepagehmm
