Color panel: let the picker grow instead of scrolling - #80527
Draft
JosVelasco wants to merge 3 commits into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
Popoveruses thesizemiddleware, which caps the popover's height and addsoverflow: autowhen its content would run past the viewport. Butsizemeasures the space available from the popover's anchored position, beforeshiftmoves it up. So when the contrast notice made the panel taller, the popover was capped and given a scrollbar even thoughshifthad 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: falseon this popover (keepingshift: true) so thesizecap is not applied and the popover grows to its natural height;shiftcontinues 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
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-heightbecomesnone,overflowvisible, and the popover renders top 1px → bottom 501px within a 732px viewport (no scroll). Screenshot to be added.AI assistance