Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duotone Settings: Add reset button and improve toggle rendering in FiltersPanel #68672

Merged

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jan 15, 2025

What, Why and How?

This PR adds a Reset button to the Duotone Filter control, enhancing its functionality and ensuring consistency with other color control components.

The Reset button is conditionally rendered based on a newly introduced clearable prop.

Testing Instructions

  1. Navigate to post edit page.
  2. Create an Image block and insert an image.
  3. Add Duotone filter to the image.
  4. Confirm, the Duotone value can now be cleared with the reset button.

Screencast

Demo

Closes: #68671

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review January 15, 2025 06:27
Copy link

github-actions bot commented Jan 15, 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: yogeshbhutkar <[email protected]>
Co-authored-by: t-hamano <[email protected]>

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

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Feb 1, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

The reset button should be visible when hovering over the dropdown button, not the reset button itself. Otherwise, people won't be able to use the reset button unless they know there is a transparent reset button there. This is probably because the structure is different from the rest of the UI.

You will probably need to move away from using ItemGroup,Item components and align with other implementations.

Note that you will also need to deal with focus issues. See this comment.

@yogeshbhutkar
Copy link
Contributor Author

You will probably need to move away from using ItemGroup,Item components and align with other implementations.

I reviewed the border-panel implementation and noticed that ItemGroup is used as a parent for the dropdown. Since ItemGroup provides the necessary border and separation, I refactored the code accordingly to align with the border-panel coding style.

Ref:

@yogeshbhutkar yogeshbhutkar force-pushed the 68671-add-reset-button-duotone branch from 23d6b4a to 300968c Compare February 3, 2025 09:59
@yogeshbhutkar
Copy link
Contributor Author

Thanks for the review.

I've applied all the suggestions. The changes are testing well for me.

changes.mov

Can you please review the PR when you get a moment?

Thanks!

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the update! I added a little bit of feedback at the end, but everything is working as expected.

@yogeshbhutkar
Copy link
Contributor Author

Thanks for your suggestions! I've incorporated all of them. When you have a moment, could you take a look? Appreciate it!

P.S. The failing test is unrelated to the changes made.

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@t-hamano t-hamano merged commit 1777430 into WordPress:trunk Feb 7, 2025
63 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.3 milestone Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duotone Filter: Add Reset button to maintain consistency with Background and Text color controls
3 participants