Nested pseudo classes with overlapping conditions behavior: Is this expected? #613
-
When you write nested pseudo classes like this (stackblitz link): function Home() {
return (<button {...stylex.props(styles.button)}>Button</button>)
}
const styles = stylex.create({
button: {
backgroundColor: {
default: 'yellow',
':hover': {
default: 'green',
':active': 'red',
},
':active': 'cyan',
},
},
}); The current behavior seems to be:
Considering Context:I've been working on a runtime-only StyleX alternative library that produces native inline styles and works without bundler setup with the same last style wins guarantee and have noticed a difference in behaviors so I'm trying to understand how nested conditions like this should apply: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The behavior isn't currently well defined. Probably we shouldn't allow nesting of similar pseudos, MQs, etc. So no active in hover, no @media in @media, etc. You probably don't need to write your own library because the dev time StyleX should do what you're trying to accomplish but faster. Currently the style sheet generation probably needs reworking to something more like what React Native for Web does |
Beta Was this translation helpful? Give feedback.
The behavior isn't currently well defined. Probably we shouldn't allow nesting of similar pseudos, MQs, etc. So no active in hover, no @media in @media, etc.
You probably don't need to write your own library because the dev time StyleX should do what you're trying to accomplish but faster. Currently the style sheet generation probably needs reworking to something more like what React Native for Web does