Skip to content

Contrast Checker only works after changing colors the second time #60825

@afercia

Description

@afercia

Description

Discovered while exploring #58936 (comment)

It appears the Contrast Checker is buggy and only works when changing one more time a color setting. This happens both when setting an insufficient color pair *the notice should appear) and when setting a sufficient one (the notice should disappear).

See attached animated GIF.

The Contrast Checker is an important feature that should work 'out of the box' for all color settings that apply to text and background. Since WordPress 6.6 is supposed to be a 'bug fixes' release, I'd like to propose to fix the Contrast Checker and make it work reliably for 6.6. Some e2e tests would be nice.

initial

Step-by-step reproduction instructions

  • Create a new post.
  • Add a Paragraph block with some text.
  • In the Settings panel, set both the text and background colors to the same color.
  • Observe the Contrast Checker doesn't render any notice.
  • Change one of the colors to another one that still produces an insufficient color pair.
  • Observe this time the Contrast Checker does render the notice.
  • Set the color text to one that produces a sufficient color pair contrast.
  • Observee the Contrast Checker notice does not disappear and still warns about insufficient contrast.
  • Change the background color to one that still produces a sufficient color pair contrast.
  • Observe this time the Contrast Checker notice does disappear, as expected.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

No one assigned

    Labels

    [Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).[Package] Block editor/packages/block-editor[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions