Skip to content

Shorthand properties transformed to wrong calculated-styles #245

@jcamden

Description

@jcamden

Describe the bug
Hello! First of all, thanks for the awesome work! We're adopting chromatic-e2e this week, and I've really been enjoying it. Anyway, we're having an issue where our shorthand properties seem to be getting broken out into their constituent properties in our Storybook builds (specifically, during the page.evaluate of our Chromatic snapshot step). For example, all: unset:

Image

gets broken out into every-style-that-wasn't-explicitly-set: unset. This is a problem because, for example, all the different ways to address border radius (e.g. border-end-end-radius, etc.), can end up overriding the intended border-radius:

Image

It also seems like some shorthand styles such as padding-block

Image

don't get properly split out into, e.g., padding-block-start if the style isn't actively applied:

Image

I can repro the problem locally and in CI, so it's not something platform-specific. And again, it occurs specifically during the page.evaluate of our Chromatic snapshot step:

Fine:
Image

Aaand not fine:
Image

To Reproduce

Wellll, I tried to reproduce on a fork. but it didn't do it---which is probably a good thing:
Image

Here's how to not reproduce:

  1. git clone [email protected]:jcamden/chromatic-e2e.git
  2. cd chromatic-e2e
  3. git checkout shorthand-css-properties
  4. yarn install
  5. yarn dev:server
  6. (new shell) yarn build
  7. yarn playwright install
  8. yarn test:playwright
  9. yarn archive-storybook:playwright (styles are correct)
  10. yarn build-archive-storybook:playwright
  11. cd storybook-static
  12. npx http-server (styles are correct)

As shown in the screenshot, the shorthand properties were preserved in these builds. I'm hoping you might have some insight as to why the shorthand properties are getting transformed during page.evaluate for our app. I really appreciate it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions