Skip to content

Focus loss when “Clear” button is used in Styles > Color #60614

@stokesman

Description

@stokesman

Description

In the Styles > Colors panel (or the Styles > Blocks > {block} > {block variation} panel) the “Clear” button is removed when the color is cleared. This results in a focus loss.

Color editing on a individual block does not suffer from this.

Apart from the specific issue this raises the question of whether the ColorPalette component could be enhanced to make this problematic scenario less likely. Hiding the clear button when the color is the default seems like it was done with good intent. It’s an indicator that the default is selected so there is nothing to clear. However that would be better done by disabling the button yet it appears ColorPalette does not support such usage. Perhaps it should.

Step-by-step reproduction instructions

  1. In the Site Editor
  2. Go to Styles > Colors
  3. Change a color to something other than the default
  4. Use the “Clear” button
  5. Notice focus is lost (palette dropdown doesn’t close as expected or if you are using the keyboard you're nowhere near where you were)

Screenshots, screen recording, code snippet

styles-colors-focus-loss.mp4

Environment info

  • Gutenberg Trunk

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

Metadata

Metadata

Assignees

Labels

[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

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