compiled icon indicating copy to clipboard operation
compiled copied to clipboard

Using `all: unset` is not predictable

Open nickrttn opened this issue 4 years ago • 2 comments

Describe the bug When using all: unset; you would want that to be the first CSS property/attribute pair to be applied to an element, eg:

const Button = styled.buttonall: unset; border: 1px solid blue; background: black; color: white; font-size: 1em;;

In the above example, all: unset must be the first property to be set because it would also unset the other properties if it would be applied to the element after them.

To Reproduce Steps to reproduce the behavior:

  1. Put the above in a project
  2. Look at the applied classes, there is no guarantee that all: unset; is first.

Expected behavior

all: unset to be applied in the right order (first if that was its place in the CSS properties).

nickrttn avatar Jun 15 '21 08:06 nickrttn

What seems to happen is that atomic css rules sometimes get redefined during runtime, causing the all: unset property to unset everything prior. It's unclear to me why atomic CSS rules get redefined, but am thinking this might be related to a framework context where different JS bundles containing the same CSS rules get loaded and defined at runtime.

christiandewit avatar Jun 15 '21 12:06 christiandewit

Thanks for raising!

Yeah this would be a tricky one. Could we order it to be always defined property?

itsdouges avatar Jun 19 '21 00:06 itsdouges