Skip to content

ColorPicker : Inconsistent behavior of default color when cleared one by one character and when cleared in one action #75243

@dpmehta

Description

@dpmehta

Description

While working with Gutenberg ColorPicker, i noticed an inconsistent behavior when removing the HEX value from input field. If we select any color from picker and if we remove it character by character then it defaults to black but if we choose whole HEX at once and clear then it defaults to whatever previously selected and also HEX value is cleared but color still remains selected in picker which can create confusion for user because HEX value is cleared but still color is showing.

Step-by-step reproduction instructions

  1. Select any custom color in the ColorPicker.

  2. Focus the HEX input field.

  3. Remove the HEX value character by character using backspace.

    • Result: the selected color resets to black.
  4. Repeat the test, but this time:

    • Select the full HEX value
    • Delete it in single action
    • Result: the previously selected color remains active

Screenshots, screen recording, code snippet

ColorPicker-issue.mov

Environment info

WordPress Version : 6.9
Gutenber Version : 22.5.0-rc.1

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions