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

React warns of “two children with the same key” due to identical custom and accent colors #316

Open
nickcernis opened this issue Nov 4, 2019 · 2 comments

Comments

@nickcernis
Copy link
Collaborator

nickcernis commented Nov 4, 2019

With define( 'SCRIPT_DEBUG', true );, a warning appears in the console when opening the color palette for the paragraph block:

Screen Shot 2019-11-04 at 09 12 33

The text, “the behavior is unsupported and could change in a future version” suggests we should address this, perhaps by altering one of the two colors slightly.

This affects both WP 5.2 and the 5.3RCs.

To reproduce

  1. Ensure define( 'SCRIPT_DEBUG', true ); is set in wp-config.php.
  2. Create a paragraph block and open the Color Settings pane in the Block sidebar.
  3. Check your browser console. (I tested Chrome.)

Expected behavior
No errors are triggered by theme default color choices.

@nickcernis nickcernis added the bug label Nov 4, 2019
@dreamwhisper
Copy link
Contributor

It seems like the same color should be allowed in the palette as we can't prevent someone from choosing the same color in the customizer. The same warning appears if you select duplicate colors even if the original defaults are different.

The key used is the hex value rather than the slug. Warning: Encountered two children with the same key, #00a33c.

Seems like this issue has come up for others as well. WordPress/gutenberg#9357

@nickcernis nickcernis added third party and removed bug labels Nov 4, 2019
@robincornett
Copy link
Contributor

I came here to report this as well. Since that thread has been ignored for nearly a year, I would suggest that the Sample theme should update one of the default color values to resolve it, even though the root of the problem stays in place.

Another reason to update one of the colors in the theme is that with them being the same, it's very difficult for a user to determine what the second color is used for until they're making changes in the Customizer, and depending on where all it's used, it's possible that users may end up with undesired changes. A quick skim suggests that the accent color is used primarily for focus and hover styles? Except for the button block? Or not--I'm in the Customizer and have changed the accent color and don't see it in use at all on the front page content (from onboarding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants