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

Site editor - Duplicated name colors when adding/deleting in custom palette #39945

Closed
geriux opened this issue Mar 31, 2022 · 2 comments · Fixed by #40837
Closed

Site editor - Duplicated name colors when adding/deleting in custom palette #39945

geriux opened this issue Mar 31, 2022 · 2 comments · Fixed by #40837
Assignees
Labels
[Type] Bug An existing feature does not function as intended

Comments

@geriux
Copy link
Member

geriux commented Mar 31, 2022

Description

While creating a custom color palette in the site editor, there's a case where deleting the first colors would cause a bug where new colors created will keep the previous name causing duplicates.

Then when using these colors that have the same name there's a bug where the color you select is not the one you see.

Step-by-step reproduction instructions

  1. Go to the site editor
  2. Create a new custom color palette
  3. Add 3 custom colors
  4. Delete the first one or the second one
  5. Add a new color (notice that it will have the same name as the previous one)
  6. Try to use your new palette and see that selecting the colors that have the same name causes an issue where you can't see the color you're actually selecting.

Screenshots, screen recording, code snippet

ColorBug.mov

Environment info

  • Gutenberg version 12.8.0
  • Browser: Chrome 98.0.4758

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@geriux geriux added the [Type] Bug An existing feature does not function as intended label Mar 31, 2022
@javierarce
Copy link
Contributor

While creating a custom color palette in the site editor, there's a case where deleting the first colors would cause a bug where new colors created will keep the previous name causing duplicates.

I imagine that this happens because we generate the name of the new color by adding one the number of rows.

A good solution that avoids repeating the name of the color, no matter how they are arranged on the list, would be to do something like Figma does with pages: sort all the pages that are labeled "Page X" (where X is a number), and then create a new page with the subsequent number.

Screen.Recording.2022-03-31.at.16.23.06.mov

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 5, 2022
@ramonjd
Copy link
Member

ramonjd commented May 5, 2022

I threw up something over at #40837

It tries to replicate Photoshop's layout behaviour:

2022-05-05 12 10 41

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants