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

Fix: Logic for Highlight/text-color format availability #65530

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

dougwollison
Copy link
Contributor

What?

Corrects the logic for showing the text-color format, either if a palette is present or if custom colors are allowed, as expected.

Why?

Previous logic mistakenly resulted in an unusable text color UI when palette was empty and custom was false, but offered no text color UI at all if palette was empty and custom was set to true.

How?

Flipped test on allowCustomControl.

Testing Instructions

  1. Open theme.json
  2. Under color settings, palette to [], custom to false
  3. Open a post or page, insert a text block
  4. Open the format dropdown, Highlight should be absent

For the inverse:

  1. Set color.custom to true
  2. Open editor, select/insert text block
  3. Open format dropdown, Highlight should be present, selecting will allow custom color selection

Copy link

github-actions bot commented Sep 20, 2024

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: dougwollison <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@dougwollison dougwollison force-pushed the fix/text-color-support-check branch from 44dfefe to 3fc5785 Compare September 26, 2024 00:55
@dougwollison
Copy link
Contributor Author

Re-wrote after updating master on fork (swore I updated it beforehand). Conflict resolved.

@Mamaduka Mamaduka added the [Package] Format library /packages/format-library label Oct 19, 2024
@Mamaduka Mamaduka self-requested a review October 19, 2024 22:59
@Mamaduka Mamaduka added the [Type] Bug An existing feature does not function as intended label Oct 19, 2024
@dougwollison dougwollison force-pushed the fix/text-color-support-check branch from 3fc5785 to 1f7cdb7 Compare November 22, 2024 03:15
Copy link
Member

@Mamaduka Mamaduka 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 fixing this bug, @dougwollison!

packages/format-library/src/text-color/index.js Outdated Show resolved Hide resolved
Previous logic showed unusable Highlight format when palette was empty and custom was disabled, and hid it when custom was enabled but palette was empty.
@dougwollison dougwollison force-pushed the fix/text-color-support-check branch from 1f7cdb7 to 1173266 Compare November 22, 2024 23:40
@Mamaduka Mamaduka merged commit 326589d into WordPress:trunk Nov 23, 2024
62 checks passed
@github-actions github-actions bot added this to the Gutenberg 19.8 milestone Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Format library /packages/format-library [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants