Skip to content

[BUGFIX] UI Customization. Fix style-prop inheritance - #396

Closed
zhuje wants to merge 1 commit into
ui-customizationfrom
zhuje/ui-customization-fix-styleprops-inheritance
Closed

zhuje wants to merge 1 commit into
ui-customizationfrom
zhuje/ui-customization-fix-styleprops-inheritance

Conversation

@zhuje

@zhuje zhuje commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes a cascade bug in the @perses-dev/components/next style-prop engine: an element could silently pick up an
ancestor's style-prop value instead of its own documented fallback.

Screenshots

Before

image

After

image

Before

image

After

image

Ladle Story

https://gist.github.com/zhuje/5c2a2d41669108dfb2941994dba682c6

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.
  • E2E tests are stable and unlikely to be flaky.
    See e2e docs for more details. Common issues include:
    • Is the data inconsistent? You need to mock API requests.
    • Does the time change? You need to use consistent time values or mock time utilities.
    • Does it have loading states? You need to wait for loading to complete.

…ment

Style props are written as inline custom properties (--ps-width, --ps-width-md, …)
and read by .ps-<prop> utility rules. Custom properties inherit, so an element
that did not set a given variable read its ancestor's value instead of the
documented fallback:

  <Box width={200}><Stack width={{ md: 400 }} /></Box>     -> inner 200px below md (expected auto)
  <Stack width={{ md: 300 }}><Stack width={200} /></Stack> -> inner 300px at md (expected 200px)

Declare the six variables as `initial` in each of the 20 base rules in
layout.css / spacing.css. `initial` is the guaranteed-invalid value, so var()
falls through to its fallback; inline values on the element still win.
@Property { inherits: false } was rejected (unsupported in Firefox < 128).

Add layout.css.test.ts / spacing.css.test.ts, deriving the prop list from the TS
registries so a future prop without matching CSS fails CI.

gzip: layout.css 1206 -> 1631 B (+425), spacing.css 948 -> 1192 B (+244).
Signed-off-by: Jenny Zhu <jenny.a.zhu@gmail.com>
@zhuje
zhuje requested a review from a team as a code owner October 26, 2026 03:03
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit a83eb64.

@jgbernalp

Copy link
Copy Markdown
Contributor

@zhuje I fixed this in #398

@zhuje

zhuje commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Double checked with Ladle story above that #398 resolves the issue. Closing this PR.

@zhuje zhuje closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants