airbnb / react-with-styles-interface-aphrodite

Interface to use react-with-styles with Aphrodite
MIT License
54 stars 14 forks source link

[RFC] Add fix for differing specificity between flippable and non-flippable versions of the same style #32

Closed majapw closed 6 years ago

majapw commented 7 years ago

This is an incomplete prototype of an idea I've been mulling about in my head for a while.

Basically, if you are relying on overriding a directional style (borderLeft/Right, paddingLeft/Right, marginLeft/Right, translateX(100)) with a non-directional style (border, padding, margin, translateX(0)), the specificity of the directional style will always win and this will probably cause a bug.

While this solution is incomplete (does not cover recursive styles very well rn), I wanted to get some feedback. The more I think about this, the more it might make sense to just get rid of shared styles entirely. It would fix the specificity problem and while it would bloat the page a little by duplicating some injected styles, it would be a much simpler process of generation and the cost may be recuped there.

Thoughts?

@yzimet @lencioni @ljharb @garrettberg @jasonkb