Repository navigation
Conversation
…an beside the trigger — the layer may overhang past the trigger
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for fixing this — a caller who asks for a 352px menu should not silently get 259px just because the trigger sits near a panel edge, and honouring the explicit width up to the viewport (minus the safe-area gutters) matches the documented Popover sizing contract.
Approval is on hold for a maintainer spec decision. Two parts of the change add new public behaviour that no current spec settles: aligned (start/end) layers gaining span-all slide fallbacks that centre on the trigger when neither side fits — the current layer-runtime contract describes span fallbacks only for centred placements — and the new public useLayer render option hasSlideFallback. A maintainer needs to provide or identify the governing spec for those additions, or update the owning spec to settle them, before this can be approved.
Two follow-ups are also recorded in the review, independent of that decision:
- For side placements (
placement="start"/"end"), the appended fallbacks span the block axis, so they cannot rescue the inline width overflow that turns the fallback on — a side-placed Popover whose width fits on neither side would still clip instead of centring as the width documentation promises. An inline-axis fallback (or scoping the promise to above/below) plus a Popover-level side-placement width test would close this. - The sizing evidence is jsdom-level (emitted width, classes, fallback strings). Real-browser before/after evidence for the rendered geometry — for example the existing Viewport Fit story and a panel-edge 352px case, including the neither-side-fits state — is still needed.
Popovers without a width and centred Popovers are unchanged, which keeps the blast radius of the core fix small.
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsPopover (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression1 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…ding owner review records the explicit-width cap and overhang rule
…on, registered in the story play guard
d1a7465 to
30ab3ff
Compare
There was a problem hiding this comment.
Thanks for fixing this — a caller who asks for a 352px menu should not silently get a much narrower one just because the trigger sits near a panel edge, and honouring the explicit width up to the viewport (minus the safe-area gutters) matches the documented Popover sizing contract. The new real-browser story is a welcome addition: it proves the 352px case renders at full width and stays on-screen.
Approval is on hold for a maintainer spec decision. Two parts of the change add new public behaviour that no current spec settles: aligned popovers placed above or below gaining span-all slide fallbacks that centre on the trigger when neither side fits, and the new public useLayer render option hasSlideFallback. The PR proposes both in a new decision marked pending owner review. A maintainer needs to provide or identify the governing spec for those additions — approving that proposed decision, or pointing to an existing spec that already covers them — before this can be approved.
Two smaller notes are recorded in the review, independent of that decision:
- Rendered evidence for the neither-side-fits state is still missing: the new story's layer fits after flipping, so the
span-allcentering path is only proven by the emitted fallback strings, and there is no WebKit result yet. - The changeset says the layer "centers on the trigger" when neither side fits, without scoping that to above/below placements; a side-placed popover flips only, so that sentence should be scoped to match.
Popovers without a width, centred popovers, and side placements' fallback behaviour are otherwise unchanged, which keeps the core fix's blast radius small.
[Automated review]
…eps its released API; no internal identifiers
There was a problem hiding this comment.
Thanks for fixing this — a caller who asks for a 352px menu should not silently get a much narrower one just because the trigger sits near a panel edge, and honouring the explicit width up to the viewport (minus the safe-area gutters) matches the documented Popover sizing contract. The new real-browser story proves the 352px case renders at full width and stays on-screen.
Approval is on hold for a maintainer spec decision. One part of the change adds new behaviour that no current spec settles: aligned popovers placed above or below gaining span-all slide fallbacks that centre on the trigger when neither side fits. The PR proposes this in a new decision marked pending owner review. A maintainer needs to approve that proposed decision, or point to an existing spec that already covers it, before this can be approved.
One smaller note is recorded in the review, independent of that decision: rendered evidence for the neither-side-fits state is still missing — the new story's layer fits after flipping, so the span-all centring path is only proven by the emitted fallback strings — and there is no WebKit result yet.
Popovers without a width, centred popovers, and side placements are otherwise unchanged, which keeps the core fix's blast radius small.
[Automated review]
There was a problem hiding this comment.
The width fix is right and the owner has confirmed it in the preview: an explicit width honoured up to the viewport rather than the span beside the trigger is what component:Popover ORD2 already promises, and the overhang reads correctly. One behavior found by testing needs resolving before this lands.
Shrink the viewport until the trigger leaves it, and the layer repositions toward the viewport edge, leaving itself less room than it had. The owner's words: "when the viewport shrinks so the target is outside of the viewport it repositions the menu towards the edge, leaving less room."
That is the slide behavior doing the wrong thing in a state nobody designed for. The span-all fallbacks keep a layer on screen while its anchor is still on screen, which is their job — but once the anchor has left the viewport entirely, sliding toward the anchor's edge pins the layer into the narrowest strip available, so a surface that had room a moment earlier is now cramped against the edge. The width fix did not cause it; it made it visible, because a layer that previously shrank to the span now has a real width to defend.
Worth settling what should happen when the anchor is no longer in view at all, since the answer is not "slide further":
- Hold the last in-view position and let the layer stay where it is until the anchor returns. The layer keeps its size; nothing reflows under the person reading it.
- Close the layer. A popover anchored to something the person can no longer see is arguably stale, and several systems dismiss on exactly this condition.
- Clamp the slide so the layer never gives up inline size to chase an anchor it cannot reach.
The first is the smallest and the least surprising; the second is a product decision rather than a geometry one. Whichever is taken, the spec's ordering rules should say it, because right now the behavior is emergent from the fallback list rather than stated anywhere.
Two things already noted that still stand:
- The
span-allcentering path has no rendered evidence. The Width Overhang story's layer fits after flipping, so the centring is proven only by the emitted fallback strings — and that is the exact state the pending decision is about. A story with a trigger where neither side fits the width would close it. - No WebKit result yet.
Everything else holds: popovers without a width, centred popovers, and side placements are unchanged, which keeps the blast radius small.
There was a problem hiding this comment.
Correcting my own framing above, having read what ships today.
I described the off-screen-anchor behavior as the slide misbehaving in a state nobody designed for. That is not accurate. On main an aligned layer has no span fallbacks at all — getPositionTryFallbacks returns flip-block, flip-inline, flip-block flip-inline for every non-centered alignment and stops there. Span sliding exists only for centered layers, and the comment says why: a flip maps center to center, so overflow on the alignment axis would clip a centered layer, while flips already resolve an aligned one.
So this change introduces span sliding to aligned layers for the first time, and the behavior the owner found is the first place it shows. Before this change an end-aligned popover with an off-screen anchor did not slide — it shrank, through the span cap this PR is removing.
That makes the question narrower than I put it. The two candidate behaviors are no longer three:
- Do not slide an aligned layer toward an anchor that has left the viewport. This restores what ships today for that state, so it is a restoration rather than a new design, and it keeps the width fix's blast radius where the PR says it is.
- Keep the slide and accept the cramped result, on the grounds that an on-screen layer beats an off-screen one. That is a real position, but it needs stating in the ordering rules rather than emerging from a fallback list, because it is new behavior for aligned layers.
I would take the first. The span-all fallbacks are there to serve the neither-side-fits case while the anchor is visible — which is the pending decision — and extending them to an anchor nobody can see is a second, separable change that this PR does not argue for.
The evidence gaps I named still stand: the centring path has no rendered proof, and there is no WebKit result.
There was a problem hiding this comment.
Owner ruling, cixzhang, 2026-10-03: an aligned layer does not slide toward an anchor that has left the viewport.
The width fix is approved and stands as built: an explicit width is honoured up to the viewport minus its gutters, never shrunk to the span of viewport beside the trigger. That is what component:Popover ORD2 already promises, and the preview shows the 352px case rendering at full width.
The span-all fallbacks stay for the case they were added to serve — neither side of a visible trigger fitting the width, where the layer centres on the trigger and slides into view. That proposed decision is approved too.
What comes out is the slide continuing once the anchor is no longer on screen. Today an aligned layer has flips only, so this state has no slide at all and the layer keeps its size; with the slide extended to aligned layers it chases the anchor to the viewport edge and pins itself into the narrowest strip available, giving up room it had a moment earlier. Restoring today's behavior there keeps this change's blast radius exactly where its summary says it is, and the owner's words are: "don't slide an aligned layer toward an off-screen anchor."
Three things to carry:
- Gate the slide on the anchor being in view. An aligned layer whose anchor has left the viewport holds its position and its size.
- State it in the ordering rules. Right now the behavior is emergent from the fallback list; the condition under which an aligned layer slides belongs in the record beside the rest of the sizing order, so the next person reading it does not have to derive it.
- Rendered evidence for the centring path. It is still proven only by emitted fallback strings — the Width Overhang story's layer fits after flipping, so the one state the decision is about is the one nobody has seen. A story with a trigger where neither side fits the width closes it. A WebKit result is still outstanding too.
Nothing else in the change needs revisiting: popovers without a width, centred popovers, and side placements are unchanged.
* spec(AST-059): the layer runtime owns the viewport inset Gutter, size cap, fallback order, app-declared inset, and the Layer stories move to the layer runtime; Popover keeps its props, styling, scrolling and the explicit-width preference. Supersedes the component-level approach in #6688 and places #6686's inset at the layer. * spec(AST-059): state the system, not the project Rubric pass (docs/contributing/spec-writing.md): the Intent names the behaviors rather than the changes that reached for them; no pull request remains as standing content; the open-pull-request and follow-up sections are gone (their durable facts are in the FRs; the rest is for the pull request description); rejected alternatives are one line each. * spec(AST-059): the app declares its floating bar on LayerProvider FR6 and DEC-4 rewrite on the owner's ruling: LayerProvider carries the inset, typed beside toast, with zero defaults; anchored layers and the toast viewport read one declaration (DEC-5). toast.inset stays as the per-edge toast override. Custom properties are the mechanism, not the API. * spec(AST-059): the first frame is the settled frame; the layer box never exceeds the viewport FR8: a layer MUST NOT paint at a geometry it is about to correct; every geometry input resolves in the same frame as the render that produced it and the runtime measures nothing after paint. FR2/FR3: the layer box never exceeds the cap; content that cannot fit overflows inside. Verification rows name both viewports and the first-frame comparison. * spec(AST-059): current — approved by the owner on 2026-10-03 /approve-spec clears the merge gate; the record's own authority is written here: authority current, approved_by cixzhang, phase accepted, DEC-2 and DEC-5 as the owner's decisions. * spec(AST-059): the gutter bounds position on the placement axis; a span last resort * spec(AST-059): the placement-axis positional gutter is one value for both edges * spec(AST-059): nested provider narrows the inset; VG1 slide-then-return
#7011) 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.
|
Closing: superseded in substance, with its coverage preserved. The defect this found is real and is fixed — an explicit width capped by the span of viewport beside the trigger rather than by the viewport itself. Its two cases that the layer stories did not reach — a side placement with a width, and a side placement where neither side fits — were ported in #7011 and landed as 3811094. They assert rendered geometry rather than class names and Also worth recording: your observation that a slide cannot rescue a side placement, because the alignment axis is the block axis there, is exactly what those two stories pin. Nothing here is lost. Thank you for the find. |
User impact
A start- or end-aligned Popover with an explicit
widthon a trigger near its panel edge renders narrower than asked: an end-aligned 352px popover on a 40px trigger 45px from a panel edge renders 274px in Chromium. A design width is unreachable near any edge.Problem and solution fit
max-inline-size: calc(100% - gutter)resolves, under anchor positioning, against the anchor's inset-modified containing block — the span beside the trigger — not the viewport.widthis the component's one sizing knob, overridden by trigger position.The fix caps an explicit width to the viewport minus both inline gutters. Dropping the span cap exposes one case the old cap masked by shrinking: when neither side of the trigger fits the width (a phone), the layer would clip. Popover therefore appends
span-allfallbacks after the runtime's flips, so the browser centers the layer on the trigger and shifts it into view — only when the width fits nowhere else.Expected behavior and authority
component:Popover(Popover.spec.md,authority: current) ORD2: "Either preferred size remains capped by available viewport and safe-area space" — the viewport, not the span beside the trigger. The one unresolved owner decision is the span-all last resort for a width that fits on neither side; this PR records it as FR8 / ORD2a / DEC-4, marked pending owner review.Smallest restoration
Popoverwith awidthand a start/end alignment:max-inline-sizebecomescalc(100vi − both gutters); the layer may overhang past the trigger's other side.position-try-fallbacks: <runtime flips>, <same> span-all, <opposite> span-allthrough the render props'style. Side placements stop at the flips.width, centered popovers,useLayer— no public API, type or default changes.Evidence
Core/Popover → Width Overhangstory on the base commit, run by the story play guard in Chromium —Explicit width was not honoured: layer is 274px wide, end span 290px, viewport 1280px.play passed: 352px wide, on-screen, overhanging the trigger.--x-width, the clamp class and the exact fallback list per alignment; the story is registered in the story play guard, so a regression failspr-a11y.Scope
Testing