Theme: Render default density selector last in design tokens CSS#75474
Theme: Render default density selector last in design tokens CSS#75474
Conversation
|
Size Change: +29 B (0%) Total Size: 3.02 MB
ℹ️ View Unchanged
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
aduth
left a comment
There was a problem hiding this comment.
This seems fine to change based on the current implementation, i.e. mutually exclusive modes that will always have higher specificity than the default values.
I was going to ask why these styles exist at all vs. just relying on the default styles from the :root selector, but then I recalled we did this intentionally to allow people to reset back to the default density if it would otherwise inherit a compact/comfortable density.
What?
Reorders the density mode selectors in the Terrazzo config so that the
defaultdensity block is rendered last in the generated CSS.Why?
When hovering over a CSS variable (e.g.
var(--wpds-dimension-gap-sm)) in the IDE, IntelliSense shows the resolved value from the last definition in the file (at least in my Cursor environment). Previously,comfortablewas rendered last, so the IDE would show comfortable density values (e.g. 12px forgap-sm) instead of the default values (8px). Rendering thedefaultdensity block last makes the IDE show the most commonly applicable values.How?
Reorder the
modeSelectorsarray interrazzo.config.tsfromdefault → compact → comfortabletocompact → comfortable → default, and regenerate the prebuilt files.Testing Instructions
packages/theme/src/prebuilt/css/design-tokens.css.[data-wpds-density='default']block should appear aftercompactandcomfortable.