Skip to content

GlobalStylesUI: Use --wpds-cursor-control design token for interact…#77335

Merged
mirka merged 4 commits into
WordPress:trunkfrom
R1shabh-Gupta:add/global-styles-ui-cursor-control-token
Apr 17, 2026
Merged

GlobalStylesUI: Use --wpds-cursor-control design token for interact…#77335
mirka merged 4 commits into
WordPress:trunkfrom
R1shabh-Gupta:add/global-styles-ui-cursor-control-token

Conversation

@R1shabh-Gupta
Copy link
Copy Markdown
Contributor

@R1shabh-Gupta R1shabh-Gupta commented Apr 14, 2026

What?

Part of #76221

Replaces hardcoded cursor: pointer declarations in @wordpress/global-styles-ui stylesheets with cursor: var(--wpds-cursor-control).

Why?

  • Update instances of cursor: pointer to use the design token for better maintenance.

How?

  • Removed cursor: pointer and used cursor: var(--wpds-cursor-control)

Note: While working on the PR, I noticed that .global-styles-ui-preview in style.scss does not appear to be used anywhere in the codebase and seems to be unused CSS. I still applied the token replacement.

Testing Instructions

  1. Go to Site Editor → Styles (/wp-admin/site-editor.php).
  2. Hover over the style variation cards — cursor should be default (not pointer).
  3. To test revisions: make and save a style change, then click the clock icon in the Styles panel header. Hover over revision items.

Use of AI Tools

Use Claude Code to review code and create pull request description.

@R1shabh-Gupta R1shabh-Gupta marked this pull request as ready for review April 15, 2026 05:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: R1shabh-Gupta <[email protected]>
Co-authored-by: mirka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@mirka mirka self-requested a review April 15, 2026 13:25
@mirka mirka added the [Type] Enhancement A suggestion for improvement. label Apr 15, 2026
Copy link
Copy Markdown
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that .global-styles-ui-preview in style.scss does not appear to be used anywhere in the codebase and seems to be unused CSS. I still applied the token replacement.

This should be verified and cleaned up, probably in a separate PR.

box-sizing: border-box;
// To round the outline in Windows 10 high contrast mode.
cursor: pointer;
cursor: var(--wpds-cursor-control);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another hardcoded pointer left in packages/global-styles-ui/src/preview-wrapper.tsx. If that cursor is still needed, it should be moved to a stylesheet and switched to var(--wpds-cursor-control).

@R1shabh-Gupta R1shabh-Gupta requested a review from mirka April 16, 2026 09:07
Copy link
Copy Markdown
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we going to clean up the unused class?

Comment on lines +110 to +114
className={
withHoverView
? 'global-styles-ui-preview__content'
: undefined
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in modifier format (see CSS coding guidelines).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mirka, thanks for reviewing the PR.

Are we going to #77335 (review) the unused class?

I was thinking of opening a separate PR for that and including a reference to this one in the description. Would that be okay?

This should be in modifier format (see CSS coding guidelines).

Apologies for the oversight. If I move the withHoverView check to the parent div, something like this:

<div
	className={ clsx( 'global-styles-ui-preview__wrapper', {
		'is-hoverable': withHoverView,
	} ) }
	style={ {
		height: normalizedHeight * ratio,
	} }
	onMouseEnter={ () => setIsHovered( true ) }
	onMouseLeave={ () => setIsHovered( false ) }
	tabIndex={ -1 }
>

I tested this on the site, and it works as expected. Would this approach be acceptable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sounds good for both points. Thanks!

Copy link
Copy Markdown
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@mirka mirka merged commit e6f2fb6 into WordPress:trunk Apr 17, 2026
41 checks passed
@github-actions github-actions Bot added this to the Gutenberg 23.1 milestone Apr 17, 2026
ciampo pushed a commit that referenced this pull request Apr 21, 2026
#77335)

* GlobalStylesUI: Use `--wpds-cursor-control` design token for interactive controls

* GlobalStylesUI: Remove stylelint configuration for cursor control token

* GlobalStylesUI: Add cursor control token to preview content styles

* GlobalStylesUI: Move cursor control style to wrapper element

Co-authored-by: R1shabh-Gupta <[email protected]>
Co-authored-by: mirka <[email protected]>
@alecgeatches alecgeatches added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Package] Components /packages/components and removed Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants