Skip to content

fix(nav): clamp dropdown to viewport and portal into fullscreen root#10297

Merged
mscolnick merged 2 commits into
mainfrom
ms/nav-followups
Jul 23, 2026
Merged

fix(nav): clamp dropdown to viewport and portal into fullscreen root#10297
mscolnick merged 2 commits into
mainfrom
ms/nav-followups

Conversation

@mscolnick

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 23, 2026 13:43
@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jul 23, 2026 3:43pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mscolnick mscolnick added the bug Something isn't working label Jul 23, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Architecture diagram
sequenceDiagram
    participant Cell as Cell Output Area
    participant Trigger as Nav Menu Trigger
    participant Viewport as NavigationMenuViewportPortal
    participant Dropdown as Dropdown Content
    participant Portal as NavigationMenuPortal
    participant FS as Fullscreen Root
    participant Body as document.body

    Note over Trigger,Viewport: Menu opens via hover/click

    Trigger->>Viewport: open=true
    Viewport->>Viewport: Measure anchor rect
    Viewport->>Viewport: Compute contentWidth from ref

    alt Content wider than viewport
        Viewport->>Viewport: Clamp left to VIEWPORT_MARGIN
        Viewport->>Viewport: Clamp left to maxLeft (avoid overflow)
    end

    Viewport->>Viewport: setPosition({left, top})

    alt Fullscreen active
        Viewport->>Portal: Render into fullscreen root
        Portal->>FS: createPortal(children, fullscreenEl)
        Note over Dropdown,FS: Position: fixed, z-50 inside fullscreen context
    else No fullscreen
        Viewport->>Portal: Render into document.body
        Portal->>Body: createPortal(children, document.body)
    end

    Dropdown-->>Trigger: Dropdown visible

    Viewport->>Viewport: requestAnimationFrame(updatePosition)
    Note over Viewport: Re-measure after layout to account for shifts

    alt User clicks trial link
        Trigger->>Dropdown: link.click({ trial: true })
        Dropdown-->>Cell: Playwright hit-target check
        alt Link clipped by cell overflow
            Cell-->>Dropdown: Test fails (not visible)
        else Link portaled & unclipped
            Cell-->>Dropdown: Test passes (visible)
        end
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread frontend/src/plugins/layout/NavigationMenuPlugin.tsx
Comment thread frontend/e2e-tests/kitchen-sink.spec.ts Outdated
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 77.01% 77165 / 100200
🔵 Statements 77.01% 77165 / 100200
🔵 Functions 71.28% 653 / 916
🔵 Branches 79.63% 4493 / 5642
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
frontend/src/plugins/layout/NavigationMenuPlugin.tsx 89.28% 100% 100% 89.28% 113-115, 334-358
Generated in workflow #19864 for commit efa1e51 by the Vitest Coverage Report Action

The kitchen_sink notebook declares auto_instantiate in its script
metadata, which is now ignored for security, so its cells never run in
edit mode and the nav menu output is never rendered — the trigger could
never be found. Move the test to a minimal, dependency-free notebook
served in run mode, which always instantiates server-side.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines 153 to +157
React.useLayoutEffect(() => {
updatePosition();
}, [updatePosition]);
if (open) {
const raf = requestAnimationFrame(updatePosition);
return () => cancelAnimationFrame(raf);
@mscolnick
mscolnick merged commit 9c7568d into main Jul 23, 2026
31 checks passed
@mscolnick
mscolnick deleted the ms/nav-followups branch July 23, 2026 16:04
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.15-dev66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants