Skip to content

test(Layer): cover a side placement, which no viewport story exercised - #7011

Merged
cixzhang merged 1 commit into
mainfrom
layer-side-placement-coverage
Oct 6, 2026
Merged

cixzhang merged 1 commit into
mainfrom
layer-side-placement-coverage

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

User impact

A side-placed layer that overflows the viewport has only two ways back on screen — flip to the trigger's other side, or be capped. Sliding cannot help: on a side placement the alignment axis is the block axis, so a slide moves the layer up or down and leaves an inline overflow exactly as it was.

Nothing proved that. Every Viewport inset story places its layer below its trigger, so placement: start | end had no coverage at either viewport. The same gap at 390px width is how the inline cap shipped broken last week.

What this adds

Two stories, running at 1280×900 and 390×844 like the other 16:

  • side placement with a width — a 320px layer placed to the inline end of a trigger 24px from that edge. 24px of room, so it must flip rather than shrink.
  • side placement, neither side fits — a 900px layer placed to the start of a centred trigger. Neither side has 900px, and on a phone the viewport does not either, so the cap is what keeps it on screen.

Both assert the rendered geometry: the width is min(asked, viewport − gutters) and the box sits inside the gutters.

Relationship to #6688

Ported from there. That change found these cases while fixing the explicit-width defect inside Popover; spec:AST-059 has since moved the fix to the layer runtime, so its implementation is superseded but its cases are not.

Its other three — start-aligned width, end-aligned width, no width, centered width — are already covered by the landed viewport stories. Its assertions read internal class names and position-try strings from the replaced implementation; these assert what a person sees instead.

Scope

  • Tests only. No source, no record, no public surface.
  • Public text and artifacts contain no internal Meta context.

Every Viewport inset story places its layer below its trigger, so the
side placements had no coverage at either viewport. A side placement is
the case where the slide cannot help: the alignment axis is the block
axis, so sliding moves the layer up or down and does nothing about an
inline overflow. Only the flip and the cap can keep it on screen.

Two stories, both running at 1280x900 and 390x844 like the rest:
a 320px layer placed to the inline end of a trigger 24px from that edge,
which must flip rather than shrink; and a 900px layer placed to the start
of a centred trigger, where neither side fits and on a phone the viewport
does not either, so the cap is what saves it.

Ported from #6688, which found these cases while fixing the explicit-width
defect at the component. Its other three cases are already covered by the
landed viewport stories, and its assertions read internal class names and
position-try strings from an implementation the layer runtime has since
replaced — these assert the rendered geometry instead.
@cixzhang
cixzhang enabled auto-merge (squash) October 6, 2026 14:47
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 6, 2026
@astracat-bot

astracat-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
⏳ Waiting for review (for maintainers only) Oct 6, 2026, 3:05 PM UTC

@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 6, 2026 2:52pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@cixzhang
cixzhang merged commit 3811094 into main Oct 6, 2026
40 checks passed
@github-actions
github-actions Bot deleted the layer-side-placement-coverage branch October 7, 2026 06:24

This branch was successfully deployed

1 active deployment
Preview — af36e421 Deployed Oct 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant