Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(editor): size the background picker to the room it has, not to a guess

Etienne Lescot6e1950039245
diff --git a/src/components/ai-edition/NewEditorShell.module.css b/src/components/ai-edition/NewEditorShell.module.css
index 4afd78cc3..b3855eed3 100644
--- a/src/components/ai-edition/NewEditorShell.module.css
+++ b/src/components/ai-edition/NewEditorShell.module.css
@@ -1086,9 +1086,13 @@
border-radius: 12px;
background: var(--surface-1);
box-shadow: var(--elev-pop);
- /* Tall content (18 swatches, or the gradient editor) scrolls itself instead of running
- off-screen on a short window. */
- max-height: min(70vh, 460px);
+ /* Radix measures the room actually left below the trigger and publishes it here, so the
+ picker uses the screen it has instead of a number guessed at authoring time. The second
+ term is the tallest it ever needs: the gradient tab is ~640px (tabs + preset grid + the
+ 240px-wide editor, whose wheel is square). A fixed 460px cap cut that editor in half and
+ read as "the gradient panel is gone" — the content was there, below the fold, behind a
+ scroll nobody could see. Beyond 680px there is nothing left to reveal. */
+ max-height: min(var(--radix-popover-content-available-height, 80vh), 680px);
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--border) transparent;
diff --git a/src/components/ai-edition/RightPanes.tsx b/src/components/ai-edition/RightPanes.tsx
index 548fea944..1deb32a52 100644
--- a/src/components/ai-edition/RightPanes.tsx
+++ b/src/components/ai-edition/RightPanes.tsx
@@ -316,6 +316,9 @@ function BackgroundSection() {
<PopoverContent
align="start"
sideOffset={6}
+ // Keeps the picker off the window edge, and the same padding is what Radix
+ // subtracts from `--radix-popover-content-available-height`, which sizes it.
+ collisionPadding={12}
animated={false}
className="w-auto border-0 bg-transparent p-0 shadow-none"
>