You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where the text says "this element should be translucent, but is not", that has bg-black bg-opacity-25 on it, but the bg opacity isn't applying due to the specificity of bg-black's default opacity.
Here's the code that reproduces this:
exportdefaultfunctionHome(){const[isReady]=useTimeout(100)return(<><Portal><divclassName={tw`bg-black text-white`}>portal element</div></Portal>{isReady()&&(<divclassName={tw`bg-black bg-opacity-25 text-white`}>
this should be translucent, but is not?
</div>)}</>)}
It happens only with the Portal on the first element, and a delayed render of the second. If anything about this changes, then the issue goes away. Very interesting and strange 🤔
The text was updated successfully, but these errors were encountered:
Thanks for the repo. That is something i waited for.
The issue is because of the static extraction. The portal styles have not been rendered on the server. We do not do any re-hydration as we haven't found any issues. All runtime styles are prepended to the server styles. Re-hydration is tricky and my lead to other problems. I'm thinking about simply appending all runtime styles to the server styles. That should fix it.
Then you'll see the styles in the dom for debugging.
sastan
changed the title
Specificity issue with bg-opacity utilities
Static extraction causes specificity issue with new styles during runtime
Jan 2, 2021
Repo: https://github.com/itsMapleLeaf/twind-specificity-issue
Where the text says "this element should be translucent, but is not", that has
bg-black bg-opacity-25
on it, but the bg opacity isn't applying due to the specificity ofbg-black
's default opacity.Here's the code that reproduces this:
It happens only with the
Portal
on the first element, and a delayed render of the second. If anything about this changes, then the issue goes away. Very interesting and strange 🤔The text was updated successfully, but these errors were encountered: