Backdrop not applying to layout
Answered
Usman posted this in #help-forum
UsmanOP
Hey so I am using headless ui with nextjs app router and for some reason the backdrop does not apply on the sidebar
P.S. The sidebar is in
P.S. The sidebar is in
layout.tsx file26 Replies
@Usman Hey so I am using headless ui with nextjs app router and for some reason the backdrop does not apply on the sidebar
P.S. The sidebar is in `layout.tsx` file
That is a simple styling issue, you can try specifying a higher
z-index to the overlay@fuma That is a simple styling issue, you can try specifying a higher `z-index` to the overlay
UsmanOP
I will try it but i don't think it's about z index
Because I can't click on the sidebar. Clicking the sidebar closes the modal
Because I can't click on the sidebar. Clicking the sidebar closes the modal
also if you're using
I don't recommend using absolute for dialogs as you may want a relative container.
position: fixed, it should be at the center of the viewport. You're using position: absolute right now?I don't recommend using absolute for dialogs as you may want a relative container.
@fuma also if you're using `position: fixed`, it should be at the center of the viewport. You're using `position: absolute` right now?
I don't recommend using absolute for dialogs as you may want a relative container.
UsmanOP
I am using headless ui. And yea for the backdrop i am using fixed
Right now on phone but wait lemme share the code
Okay, if you can't get it work on your project, try copying the [official example](https://headlessui.com/react/dialog) and figure out what's wrong in your code
@fuma Okay, if you can't get it work on your project, try copying the [official example](https://headlessui.com/react/dialog) and figure out what's wrong in your code
UsmanOP
Yep I did copy the code from headless ui
does it work for you?
@fuma does it work for you?
UsmanOP
Nope. I'm using the official code but the backdrop doesn't appear on sidebar
The sidebar is in
layout.tsx btwhold up, what is your code in sidebar?
@fuma hold up, what is your code in sidebar?
UsmanOP
Ahh wait lemme get a screenshot of that. It's a huge component tho
Oh i think i understand now
Both have
fixedThe backdrop and the sidebar
@Usman Ahh wait lemme get a screenshot of that. It's a huge component tho
Yea... you shouldn't have both fixed, they're overlapping
@fuma Yea... you shouldn't have both fixed, they're overlapping
UsmanOP
Making one of these
absolute will fix the issue?yes, I remember
z-index also helps tooAnswer
UsmanOP
Let's see. Not very good at positioning haha
@fuma yes, I remember `z-index` also helps too
UsmanOP
Sure I'll keep that in mind.
Thanks!
Thanks!
UsmanOP
@fuma Solved it just with
So bad of me I didn't see the code after I copied and pasted it.
z-index So bad of me I didn't see the code after I copied and pasted it.
The sidebar was
z-40 and dialog was z-10 lolNice! Mark my answer as the solution if your problem has been solved 
