From 9a2d73c4b6345e7927a4b9915c7908010ad60aae Mon Sep 17 00:00:00 2001 From: Guillermo Marin <52298929+guillermoscript@users.noreply.github.com> Date: Sun, 26 Jul 2026 20:11:37 +0200 Subject: [PATCH] fix(editor): stop the add-block palette from being clipped by the viewport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The block palette lists 23 block types across 5 groups (~875px tall), but PopoverContent had no height cap and no scroll, so the bottom of the list was cut off by the viewport on desktop — "Separador" was unreachable and the last row of "Estructura" sat half off-screen. `popover.tsx` was the only base-ui overlay primitive missing the `max-h-(--available-height) overflow-y-auto` treatment that select, dropdown-menu and combobox already have, so fix it there: every over-tall popover now scrolls inside the space the positioner reports instead of overflowing (lesson-component-picker had the same latent bug). Also bumped the palette's legibility: item labels 11px -> 12px at full foreground contrast, group headings 10px/60% -> 11px at full muted-foreground, and the popover 340px -> 360px so the wider labels fit. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01MVN1bVpXJQ2CT7nv4acFRz --- components/teacher/block-editor/add-block-menu.tsx | 14 +++++++++----- components/ui/popover.tsx | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/teacher/block-editor/add-block-menu.tsx b/components/teacher/block-editor/add-block-menu.tsx index 6be34e0de..213216786 100644 --- a/components/teacher/block-editor/add-block-menu.tsx +++ b/components/teacher/block-editor/add-block-menu.tsx @@ -91,6 +91,10 @@ interface AddBlockMenuProps { position?: 'top' | 'inline' | 'between' } +// The palette is taller than the room most triggers leave on screen; PopoverContent +// caps itself at `--available-height` and scrolls, so all 23 blocks stay reachable. +const PALETTE_POPOVER_CLASS = 'w-[360px] p-3' + export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProps) { const [open, setOpen] = useState(false) @@ -111,7 +115,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp - + @@ -128,7 +132,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp Añadir bloque - + @@ -144,7 +148,7 @@ export function AddBlockMenu({ onSelect, position = 'inline' }: AddBlockMenuProp > - + @@ -159,7 +163,7 @@ function BlockPalette({ onSelect }: { onSelect: (type: BlockType) => void }) {
{BLOCK_GROUPS.map((group) => (
-

+

{group.label}

@@ -181,7 +185,7 @@ function BlockPalette({ onSelect }: { onSelect: (type: BlockType) => void }) {
- + {meta?.label || type} diff --git a/components/ui/popover.tsx b/components/ui/popover.tsx index 52079097d..39272b473 100644 --- a/components/ui/popover.tsx +++ b/components/ui/popover.tsx @@ -37,7 +37,7 @@ function PopoverContent({