Replies: 6 comments
-
Stacking context can be hard to deal with, for modals usually it's best if they are used at the end of the document. Tailwindcss uses the fairly widely adopted This rule is also part of |
Beta Was this translation helpful? Give feedback.
-
Thanks @tlgreg for the answer Well my modal is part of a component that has to be put before the Whoever is putting |
Beta Was this translation helpful? Give feedback.
-
Can you share a demo that reproduces the issue? It sounds like it would be fixable by adding a position and a z-index so want to understand why that's not working. Either way not going to change this rule in Tailwind because we don't want to deviate from normalize. |
Beta Was this translation helpful? Give feedback.
-
@adamwathan sure thing: I don't understand why you're making a god out of normalize here. If they're doing the right thing and I'm doing something wrong, I'll learn it and be grateful, but if they're doing something wrong, why should we just keep doing it because normalize has done it?! |
Beta Was this translation helpful? Give feedback.
-
In this case, a The issue here is that the elements are on separate stacking context and Honestly stacking context and what creates one and what doesn't can confuse me sometimes, but in most cases, it can be worked around. If you want to read some about z-index and stacking context:
About This was fixed by normalize with resetting back the vertical-alignment of the elements and position them instead. This change has its pros and cons and can be considered a more opinionated one, but definitely not straight wrong. If there is a better solution which doesn't have such a drawback but does the same job it definitely can be considered. Though I'd add it to |
Beta Was this translation helpful? Give feedback.
-
That did cover the
I understand that we have to make compromises here, and I think the idea is, wanting a pixel perfect line alignment is a more common scenario than a Thank you for taking the time @tlgreg |
Beta Was this translation helpful? Give feedback.
-
I have a
sub
element on my page, and when I create a modal that is arelative
div withz-50
thesub
still sticks in front of it. I even triedz-index: 99999999999;
in the dev tools, no luck.When I remove
position: relative
fromsub
styles it goes behind.I know you're hard resetting browser styles, but this is a problem.
Beta Was this translation helpful? Give feedback.
All reactions