Theme: Add design token for interactive non-link elements#75697
Conversation
| { | ||
| "wpds-cursor": { | ||
| "$type": "string", | ||
| "control": { |
There was a problem hiding this comment.
Some other possibilities for the name:
interactive-non-linkinteractive-control
control is a bit vague, but I think there's a slight possibility that we may also need a disabled version of the token at some point (control-disabled or something).
There was a problem hiding this comment.
I likecontrol, it's an established term that already implicitly excludes links.
|
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. |
|
Size Change: +163 B (0%) Total Size: 6.84 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 453da03. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22151732147
|
|
Thanks for the PR, good motivation. It is indeed a contentious change: I'm pro "default" as that is the operating system way forward. Yet that stance, as it turns out, is so unusual for other contributors that the absence of the "pointer" cursor on buttons is often flagged as a bug. But since that's a personal opinion, I'm happy to defer to a consensus, which leads me to another personal opinion (softly felt at that): this just needs a decision, and I don't think we need to surface this as an option. If that decision is to go pointer-by-default today, presumably we can change our minds again in a couple of years if the winds change? But that's also me not blocking this, I'm not against options at all, and if this is option-worthy, happy to support it. |
|
IMO the right approach is:
In other words, I agree with the changes proposed in this PR. |
ciampo
left a comment
There was a problem hiding this comment.
Forgot to mention, let's add a CHANGELOG entry too
* Theme: Add cursor control design token * Add changelog Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]> Co-authored-by: jasmussen <[email protected]>
What?
I'm proposing we add a new
--wpds-cursor-controldesign token to@wordpress/theme, intended for thecursorstyle of interactive controls that are not links (e.g. buttons, checkboxes, and toggles).Why?
There's a growing consensus that
cursor: pointeris overused on non-link interactive elements (#63756), and we'd like to start aligning with that direction. However, this is a potentially contentious change, and it may end up as a user preference in the future, or even revert it.Extracting the cursor value into a design token lets us decouple the policy decision from the individual component styles. Components can adopt the token now, and the actual value can be changed in one place later — whether that's a global switch, a user preference, or a different default.
The token currently defaults to
default.How?
tokens/cursor.jsonusing Terrazzo'sstringextension type.terrazzo.config.tsand rebuilt vianpm run build:tokens.Testing Instructions
cd packages/theme && npm run build:tokenspackages/theme/src/prebuilt/css/design-tokens.csscontains--wpds-cursor-control: default;