Repository navigation
fix(ContextMenu): the menu paints in Safari when its trigger sits in a scroll container - #7369
Conversation
…a scroll container ContextMenu anchors its menu to a box at the pointer, and that box was empty. WebKit counts an empty anchor box inside a scroll container as clipped, so the default `position-visibility: anchors-visible` hid the open menu: it stayed open, focused and hit-testable, but never painted. The cursor anchor is now 1px. A point on the trigger's end edge (where a keyboard-invoked open lands) steps back by that pixel, so the anchor never hangs past the trigger: there it would add scrollable overflow and be clipped by a scroller whose edge meets the trigger's, hiding the menu in Chromium too. The browser still hides the menu while a scroller clips the pointer position, as it does for every other anchored layer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
The story's scrolling box holds nothing focusable, so axe flagged it (scrollable-region-focusable). It takes a tab stop and a name, as the other scrolling stories do.
There was a problem hiding this comment.
Recommended for approval: giving the cursor anchor a 1px box, kept inside the trigger at its end edges, restores the menu in WebKit inside scroll containers, and in Chromium the only change is the disclosed 1px offset. The unit tests and the new browser spec cover it, and the spec passes in both Chromium and Playwright WebKit, where the old zero-size anchor leaves the open menu unpainted. Optionally, a desktop Safari 26 right-click check would cover the macOS path the description mentions, and note that pull-request CI does not run the new browser spec today (only the release-check Chromium sweep does).
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression42 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 22 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
CodeBunny approved at this head; CI green. Approved.
|
/approve-spec b68db5c |
User impact
In Safari 26 (measured on iOS 26.2), a
ContextMenuwhose trigger sits inside a scroll container (anyoverflow: autobox) opens a menu that never paints. It is open, but nothing shows. Chromium paints it, and so does Safari with no scroller around the trigger.Problem and solution fit
width: 0; height: 0). The defaultposition-visibility: anchors-visiblehides a box whose anchor is clipped, and WebKit counts an empty anchor inside a scroller as clipped.Expected behavior and authority
architecture:layer-runtime(current): layered UI must "stay positioned against its trigger".component:ContextMenuFR1 (draft) describes it but does not govern.Smallest restoration
cursorAnchoris 1px instead of 0, so WebKit sees it whenever its pixel is visible.positionVisibility: 'always': that paints the menu over unrelated content once a scroller clips its pointer position, unlike every other anchored layer and Chromium today.Evidence
main. A keyboard open on the scroller's edge adds no overflow.main. The browser spec fails onmain, withposition-visibility: always, and with a bare 1px box.Scope
Writing rubric results
Testing
pnpm vitest run --project ui packages/core/src/ContextMenu/: 55 passed. Withmain'sContextMenu.tsx, 3 fail (anchor box size, keyboard edge, end-edge step-back).pnpm exec playwright test packages/core/src/ContextMenu/__tests__/ContextMenuCursorAnchor.a11y.browser.spec.ts --project=chromium, run against Storybook builds:maincode: the anchor-box test fails;position-visibility: alwaysinjected: the scroll test fails;mainand branch builds of the story, long press held, screenshots of each state.check:knowledge,check:changesets,check:syncand the Storybook build are clean.