Repository navigation
feat(core): let the Bottom Sheet's host choose its snap points - #5203
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 02:06
de90ac3 to
9450b13
Compare
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBottomSheet (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 02:16
9450b13 to
7c743a2
Compare
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 05:42
7c743a2 to
533f5cc
Compare
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
August 19, 2026 05:42
This was referenced Aug 19, 2026
imdreamrunner
marked this pull request as ready for review
August 19, 2026 06:05
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 06:19
533f5cc to
0cb1ebb
Compare
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 06:39
0cb1ebb to
c9769e5
Compare
`snapPoints` makes the drag-to-resize stops the host's choice, and a sheet
now has none unless it asks. A stop is the sheet's visible height, written
as a viewport fraction (0.5), a percentage ('50%'), or a px length
('320px') — matching `height`, where a bare number is also px and a string
carries its unit.
The shortest stop used to be treated as a peek unconditionally: it kept the
sheet's full layout height, slid below the viewport, and thinned the scrim.
That is right for a sliver and wrong for a working height, so a sheet with
one 50% stop would have rested at half the screen under a thinned backdrop.
A peek is now a stop that is at most a quarter of the sheet; taller stops
lay their content out and keep the scrim full.
imdreamrunner
force-pushed
the
bottom-sheet-snap-points
branch
from
August 19, 2026 06:55
c9769e5 to
90084bc
Compare
ernestt
pushed a commit
that referenced
this pull request
Aug 19, 2026
`snapPoints` makes the drag-to-resize stops the host's choice, and a sheet
now has none unless it asks. A stop is the sheet's visible height, written
as a viewport fraction (0.5), a percentage ('50%'), or a px length
('320px') — matching `height`, where a bare number is also px and a string
carries its unit.
The shortest stop used to be treated as a peek unconditionally: it kept the
sheet's full layout height, slid below the viewport, and thinned the scrim.
That is right for a sliver and wrong for a working height, so a sheet with
one 50% stop would have rested at half the screen under a thinned backdrop.
A peek is now a stop that is at most a quarter of the sheet; taller stops
lay their content out and keep the scrim full.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
snapPointsmakes the Bottom Sheet's drag-to-resize stops the host's choice.A stop is the sheet's visible height, in the same spellings
heightalreadytakes: a bare number is a viewport fraction (
0.5= half the screen),'50%'is that spelled in CSS,
'320px'is absolute. Fractions and percentagesre-resolve against
window.innerHeightwhen the viewport changes, so a sheetkeeps the stop the user chose across a rotation; swapping the points under a
resting sheet re-anchors it the same way. Anything else —
'50','30rem',calc(), a number above 1 — is ignored with a dev warning naming the value.The whitelist is deliberate: the resolver runs inside the drag loop, so every
accepted unit has to be arithmetic on the viewport height rather than a layout.
Behavior change (deliberate, not breaking)
Every sheet used to carry three built-in stops — 14%, 50% and 92% of the
viewport — so a drag could leave it resting somewhere the host never asked for.
A sheet now opens and closes unless
snapPointssays otherwise.Existing apps keep working: nothing was removed or renamed, and swipe-to-dismiss,
the height budgets, and mobile-keyboard accommodation are untouched. To keep the
old stops, pass
snapPoints={[0.14, 0.5, 0.92]}. Filed[feat]/patch ratherthan
[breaking]on that basis — flagging it here because a changed default isexactly the thing worth a second opinion.
The peek rule had to change with it
The shortest stop used to be a "peek" unconditionally: it kept the sheet's full
layout height, slid below the viewport instead of reflowing, and thinned the
scrim to 0.3. Right for a sliver, wrong for a working height — and
[0.5], themost likely first thing anyone writes, would have rested at half the screen
under a thinned backdrop.
A peek is now a stop that is at most a quarter of the sheet. Taller stops lay
their content out and keep the scrim full.
scrimOpacityForOffsetfollows: fulldown to the shortest working stop, thinning only onto a peek or out through the
dismiss overshoot.
Where the examples land
BottomSheetSnapPointsblock underpackages/cli/assets/templates/blocks/components/BottomSheet/, which is whatthe docsite's example registry renders. It is the peek case
(
['96px', '50%']), alongside the existing Heights / Mobile keyboard / Noscrim blocks. Visible rather than
hidden: true, matching all 630 existingcomponent blocks — the lifecycle rule's conflict with that is filed as Do new example blocks need hidden: true? Rule says yes, all 630 existing blocks say no #5206.
SnapPoints([0.5]) andSnapPointsWithPeek(
['96px', '50%']).astryx component BottomSheet) — two.doc.mjsexamples,the
snapPointsprop row, and the correctedheightcopy. This is theagent-facing surface; it does not feed the docsite.
Evidence
Unit tests cover the parser, the peek rule and the scrim curve. Beyond those, I
drove the built component in Chromium at 390×844 with real touch drags and read
back what the sheet actually did:
snapPoints[0.5]['96px','50%']['96px','50%']translateY(680px)['320px']Rows 3 and 4 are the peek rule: the same sheet keeps a full scrim and reflows at
its half stop, then thins the scrim and slides at its 96px stop.
The re-anchor-on-change test is red without the effect that implements it
(
expected '448px' to be '248px').pnpm lint:strict,pnpm test(10703 passing),pnpm buildall clean.Notes for review
snapPointsand theBottomSheetSnapPointtype.Worth a human call on the shape, particularly
number= viewport fractionwhile
height's number is px. That asymmetry is deliberate: percentages arewhat snap points overwhelmingly are, and
'50%'does not resolve onheight(the positioner has no definite block size), so the two props could not have
been made identical anyway.
useLayoutEffectinuseSheetGesturesre-anchors a resting sheetwhen the points change, carrying two
set-state-in-effectsuppressions. Thecorrection depends on a post-layout measurement, so it cannot move to render
or to an event handler; both writes sit behind an equality guard, so a
re-anchor that finds nothing to change sets nothing. It also moved
snapHeightsRefout of the batched ref-refresh effect and into the renderbody: layout effects run before passive ones, so the re-anchor would
otherwise have read the previous resolver and concluded nothing had changed
(
expected 200 to be 250without the move).never checked this component — no Bottom Sheet story rendered open, so the
scroll body was never audited. My peek story did, and axe flagged
scrollable-region-focusable(serious): a keyboard user cannot scroll thesheet body when its content has no focusable children. Older than this PR,
and the fix (a conditional
tabIndex) adds a tab stop to every sheet, so itwants its own review. I made the story closed by default, matching all nine
siblings.
BottomSheet.test.tsxcases now passsnapPointsexplicitly. They wereasserting detent geometry against the old built-in stops; the assertions are
unchanged.