Skip to content

Fix: Keep Guide close button visible on hover#73220

Merged
aduth merged 4 commits intoWordPress:trunkfrom
RoyHridoy:fix/guide-close-button-hover
Nov 17, 2025
Merged

Fix: Keep Guide close button visible on hover#73220
aduth merged 4 commits intoWordPress:trunkfrom
RoyHridoy:fix/guide-close-button-hover

Conversation

@RoyHridoy
Copy link
Contributor

@RoyHridoy RoyHridoy commented Nov 13, 2025

What?

Closes #73219

Why?

This PR fixes an accessibility/visibility issue in the Guide component.

Currently, the close button becomes invisible on hover because it changes to white while the background is also white.

How?

The Guide component is shared across several welcome-guide implementations
(edit-site, edit-post, editor, and edit-widgets). These use blue backgrounds,
which required a white hover color for the close button.

However, this hover style caused inconsistency in other contexts where Guide
is used on light backgrounds.

This change removes the hover style from Guide and applies it only in
welcome-guide components, keeping Guide generic and easier to reuse.

Testing Instructions

  1. Run npm run storybook:dev
  2. Open the Guide component
  3. Hover over the close button
  4. The button should remain visible and turn blue.

Screenshots or screencast

Before After
image image
screencast-13-11-2025.mp4

@RoyHridoy RoyHridoy requested a review from ajitbohra as a code owner November 13, 2025 02:28
@github-actions
Copy link

github-actions bot commented Nov 13, 2025

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: RoyHridoy <[email protected]>
Co-authored-by: aduth <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: jasmussen <[email protected]>

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

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 13, 2025
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @RoyHridoy! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@jameskoster
Copy link
Contributor

This is a good fix, but let's test the Guide instances in the Editor too. When the default admin theme is selected I suspect the close button will become invisible on hover due to the color of the illustrations used there? We should fix any issues there before merging I think.

@RoyHridoy RoyHridoy marked this pull request as ready for review November 13, 2025 12:41
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Nov 13, 2025
@jameskoster
Copy link
Contributor

I don't love the proliferation of the style override, but at least the component is fixed. I'll defer to others on whether this trade-off is worth it.

@RoyHridoy
Copy link
Contributor Author

I don't love the proliferation of the style override, but at least the component is fixed. I'll defer to others on whether this trade-off is worth it.

Thanks for the feedback! I totally understand the concern about adding more style overrides. Ideally, I’d avoid both overrides and duplicated styles.

While working on this, I noticed that there’s already some CSS duplication in the following files:

packages/editor/src/components/global-styles-sidebar/style.scss
packages/edit-post/src/components/welcome-guide/style.scss
packages/edit-widgets/src/components/welcome-guide/style.scss
packages/edit-site/src/components/welcome-guide/style.scss

Applying this scoped override felt like the most consistent and least disruptive approach for now.

I’m definitely open to learning about alternative solutions if there’s a cleaner way to handle this, just felt other options might require more effort for a small fix like this.

@Mamaduka Mamaduka requested a review from a team November 14, 2025 10:36
Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

I think this is absolutely an improvement to the base Guide component we should make, as its current default behavior is quite problematic.

I'll review to check current usage is covered, but another alternative to consider is a default which might work better more broadly, like a hover effect that does some color mixing to lighten the color (e.g. fill: color-mix(in srgb, white 30%, currentColor)).

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

As best I can tell, this covers existing usage so there shouldn't be any regressions. I think we may still want some hover effect for the default component, but it doesn't impact current usage.

So it looks good to me 👍 But I'm curious for feedback on the idea of color mixing or default hover effects.

@RoyHridoy
Copy link
Contributor Author

RoyHridoy commented Nov 14, 2025

As best I can tell, this covers existing usage so there shouldn't be any regressions. I think we may still want some hover effect for the default component, but it doesn't impact current usage.

So it looks good to me 👍 But I'm curious for feedback on the idea of color mixing or default hover effects.

Nice idea! Felt excited to do this experiment. Here is the result for various (color-mix) hover state -

30% white with currentColor

WelCome Guide 30% White currentColor Only Guide 30% White currentColor
30-white-welcome 30-white-standalone

50% white with currentColor

WelCome Guide 50% White currentColor Only Guide 50% White currentColor
50-white-welcome 50-white-standalone

Only CurrentColor
only currentColor

My Observation

  • currentColor may be not same always with the background (like white background or current welcome-guide (light blue))
  • So, depending on the use case, the end users may need to override the default hover effect.
  • As Close Button is a Button Type by default, it gets some hover style. (Removing hover from Guide doesn't create problems)
  • Provided Solution didn't create any problem for the existing implementation, and Guide also gets the default style.
  • Keep the close button to the outside (top right) of the modal can be another approach, but maybe it doesn't align with the current design system.

@aduth
Copy link
Member

aduth commented Nov 17, 2025

Thanks for exploring those options @RoyHridoy ! Just to clarify, is your suggestion to proceed with these changes as-is and not introduce the color mixing? I agree that some of those combinations aren't great, stemming from the currentColor value. We could maybe revisit each use-case separately. The current changes seem like a safe way to prevent regressions while addressing the underlying cause.

@aduth
Copy link
Member

aduth commented Nov 17, 2025

It also might be worthwhile to note this fix in the components changelog (per the optional, failing build), though not strictly necessary.

@RoyHridoy
Copy link
Contributor Author

Just to clarify, is your suggestion to proceed with these changes as-is and not introduce the color mixing?

Right! The intention is to move forward with these changes as-is. Adding color mixing introduced edge cases and inconsistent hover colors, so addressing each consumer individually later is a safer strategy. The current solution keeps Guide generic and prevents the regression.

I’d also include the changelog update. Appreciate the review!

The failure looks like a TypeScript memory issue, not related to my changes. A re-run should fix it.

@aduth
Copy link
Member

aduth commented Nov 17, 2025

Sounds good 👍 I also see some similar discussion in #73219 to this effect of follow-up with revisiting guides.

Let's get this fix merged in the meantime 🚀 Congrats on your first contribution!

@aduth aduth merged commit 558290f into WordPress:trunk Nov 17, 2025
43 of 44 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.2 milestone Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Guide Component: Close button becomes invisible on hover

4 participants