close
Skip to content

Color panel: let the picker grow instead of scrolling - #80527

Draft
JosVelasco wants to merge 3 commits into
WordPress:trunkfrom
JosVelasco:fix/color-panel-no-scroll
Draft

Color panel: let the picker grow instead of scrolling#80527
JosVelasco wants to merge 3 commits into
WordPress:trunkfrom
JosVelasco:fix/color-panel-no-scroll

Conversation

@JosVelasco

Copy link
Copy Markdown
Contributor

What?

When a block's colour has poor contrast, the colour-settings popover can grow tall enough to get an internal scrollbar, hiding part of the contrast notice. This lets the popover grow to its natural height instead, so the whole picker — including the notice — stays readable at once.

Why?

The colour dropdown's Popover uses the size middleware, which caps the popover's height and adds overflow: auto when its content would run past the viewport. But size measures the space available from the popover's anchored position, before shift moves it up. So when the contrast notice made the panel taller, the popover was capped and given a scrollbar even though shift had already moved it to the top of the viewport with plenty of room for the full content below.

Observed in the editor: content needed ~500px and the viewport was ~732px with the popover sitting at the top, yet it was capped at ~477px and scrolled — leaving ~246px of empty space below the scrollbar.

How?

Set resize: false on this popover (keeping shift: true) so the size cap is not applied and the popover grows to its natural height; shift continues to keep it within the viewport.

Trade-off: without the cap, a popover taller than the entire viewport would clip rather than scroll. In practice this picker plus its notice is ~500px, well under a normal viewport, so there is ample headroom; the change trades a scrollbar that is essentially always avoidable for that rare edge case.

Testing Instructions

  1. On a light-background theme (e.g. Twenty Twenty-Five), select a Paragraph.
  2. Block → Typography → Color, and give it a light colour so the contrast notice appears (white text on a cream background is reliably "poor").
  3. Observe the colour-settings popover with the notice at the bottom.

Expected: the whole popover — swatches, picker, and the full "poor contrast" notice — is visible with no internal scrollbar, and the popover stays within the viewport.

Screenshots or screencast

Verified in the editor: max-height becomes none, overflow visible, and the popover renders top 1px → bottom 501px within a 732px viewport (no scroll). Screenshot to be added.

AI assistance

  • AI assistance: Yes
  • Tool(s) used: Claude Code (Claude Opus 4.8)
  • AI diagnosed the cause (measuring the popover geometry against the viewport), drafted the one-line change and this description, and the change has been reviewed by the contributor.

When the contrast-warning notice appears, the color-settings popover can grow
taller than the space below its anchor. The Popover `size` middleware then
caps its height and adds an internal scrollbar — even after `shift` has moved
the popover up and there is room on screen for the full content, leaving the
notice partly hidden behind the scroll.

Set `resize: false` on the popover (keeping `shift`) so it grows to its
natural height and the whole picker, including the contrast notice, stays
readable at once. `shift` continues to keep it within the viewport.
@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant