Repository navigation
Conversation
Under a finger (a coarse primary pointer, on every touch device), a Toast's swipe now follows the iOS notification banner, as measured on the iOS 26.2 simulator. The card stays still for the first 14 px, then follows at 0.55 of the finger. A drag that turns back stretches it and springs it back. A release dismisses when the card is far enough out or the finger flicks toward the edge. Anything else springs it back on the settle spring. However a toast is dismissed, the card first slides past its edge, and its row closes after it. With a fine pointer nothing changes. The values live in a Toast domain of the UIKit table (motion/uikit/toast.ts). The swipe runs on the shared gesture system and the compositor animator, in Toast's touch layer (useToastBannerSwipe). A sandbox page shows a top toast to swipe away, to turn back and to pull past where it started, on a page whose document scrolls.
Toast's record names useToastBannerSwipe.ts, the swipe and the exit under a finger with the swipe's math, as Toast's own module. Only Toast.tsx imports it, and its values are the UIKit table's Toast domain.
A finger that lands on the card while it springs back or leaves now catches it where it shows, read from its curve, and the card follows the finger. A card caught on its way out leaves once the finger lifts, since its toast is dismissed. Before, those touches passed through to the page. A browser spec proves both catches in Chromium and WebKit. Toast's record now states that it takes no presentation prop, as its owner decided, and the touch wording names a coarse primary pointer instead of every touch device.
A toast dismissed while a finger drags its card now leaves once the finger lifts. Before, the drag stopped the exit, and the retract never ended. In a viewport, a dismissal under a finger is reported at once, and the row holds the card until the retract ends. So an update with the same uniqueID during the retract opens its own row, instead of being dismissed unseen. The finger tests gain a horizontal drag, a second finger and a drag from an interactive descendant. The touch layer's and the Toast table's file headers keep only their fields. Toast FR4 records FR36's measured values under a finger, and DEC-1 quotes the decision.
Under a finger every exit (a swipe, the close button, the timeout and an app's dismiss) already slides the card past its edge on the banner's measured duration and curve. Toast's record now carries that as the owner's decision, the touch-presentations record names it as Toast's exception for a tap dismiss, and a browser case checks each exit path. Under Reduce Motion, WebKit faded the card back to rest twice after a drag that turned back: the card's stylesheet transition replayed when the touch layer handed the opacity back. The touch layer now turns the card's transitions off once it moves the card, and gives them back when the pointer turns fine. A finger that drags the card, once the swipe claims the touch, or that catches it mid-motion, now starts no text selection until it lifts. A still hold on a resting card still selects. The touch-presentations record lists Toast's measured release values beside the sheet's. The Reduce Motion fade is named for a finger (a coarse primary pointer), not a touch screen, and file headers keep only their fields.
Under a finger a swipe's commit plays the banner's measured slide too. Toast's decision now says it takes the place of the touch-presentations record's tempo-scaled commit spring and named motion role there, and the record's motion table says the same.
The touch layer's options and the card's retract callbacks and exit state were refs written during render. They now come from useCommittedRef, which stores the committed value in an insertion effect. The touch layer's SYNC list also names the swipe scroll spec.
The toast's dismissal was a ref assigned during render, because the timer and gesture callbacks defined above it read it. It now starts as a no-op and useCommittedRefInto stores it in an insertion effect, before any layout effect of the same commit. A case clicks the close button from a layout effect in the toast's first commit.
The touch layer turned the card's stylesheet transitions off at touch-down, so a tap during the entrance snapped the card to rest. It now turns them off only when it moves the card: when a finger catches it, when the swipe begins, and when it retracts.
The touch-presentations record's FR4 and FR38 now point to Toast's exception: under a finger its exit plays a measured curve, and its commit is FR45's exception (Toast's DEC-2).
AST-094 FR7 now names Toast's exit under a finger as FR45's exception. Toast FR4 now says that under a finger a second touch does not end a claimed swipe and the first lift decides; with a fine pointer a second contact abandons the swipe and the toast returns. Toast's requirement table re-pads to the longer row.
A swipe that began, or a dismissal that started, while the toast was still entering turned the card's stylesheet transitions off. That cut the entrance, so the card jumped to rest and full opacity. The layer now turns them off only just before a Reduce Motion fade, which is the only time WebKit replays them, so an entrance runs on under a finger.
Under Reduce Motion, a dismissal in the toast's first 200 ms turned the card's transitions off before its fade call. That cut the entrance fade, so the card stepped to full opacity first. The exit now calls the animator first, which takes the opacity on screen, then turns the transitions off. That also ends a running opacity transition, which WebKit would keep.
Under a finger, the swipe took its selection lock only once it began, 10 px into the drag. Chrome withholds a touch's moves inside its touch slop, and a finger held there for the long-press time starts a selection. So a slow drag selected the word under the finger before the swipe could claim it, and the card never moved. The lock now starts at touch-down for every finger on the card, as it did for a catching one, so a still hold on the card selects nothing either.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
There was a problem hiding this comment.
Approval is on hold: this preview rewrites Toast's record and the touch-presentations record, and adds a new rule that any finger on a toast takes no text selection, and no engineering owner has approved this head yet. Those record changes are Toast FR4, FR5, DEC-1 and DEC-2 and the touch-presentations FR4, FR7, FR36, FR38 and FR45 exceptions. The new rule means a long press on a phone can no longer select or copy toast text. An engineering owner records that decision by commenting /approve-spec with this pull request's full head SHA; as an engineering owner, the author may do so too.
These still need changes, independent of that decision:
- The layout Effect in
useToastBannerSwipe.ts(lines 249–259) writeswill-changeinline and names no external system; movewill-changeinto Toast's StyleX root style under the coarse-pointer media key, cleartransition-propertywhere the touch layer sets it, and delete the Effect. motion/uikit/toast.tsis a new internal shared module (imported byuseToastBannerSwipe.ts) that no current record names, so it needs an owner API decision that says why existing modules are not enough; an owner's approval of this head's Toast record, which names it, settles this.- The pull request states no Android emulator run (normal, animations removed, slow profile) or real iPhone run at this head, which the touch-presentations record requires for these touch claims, above all the slow-drag selection fix; add each result in the description.
Non-blocking: the changeset does not mention the new selection behavior, and the description names no component scope.
Claims and files checked
- Claim: under a finger the card waits 14 px, then follows at 0.55 with no jump. Verified:
followOffset,toastSwipe.test.ts. - Claim: a drag that turns back stretches the card and springs it back. Verified:
followOffsetandisDismissRelease, with a jsdom case. - Claim: a quick flick or a far enough drag dismisses, and anything else springs back. Verified:
isDismissReleaseand its recorded-release table. - Claim: every dismissal slides the card past its edge unfaded, then the row closes. Verified:
requestDismiss, the exiting effect and the viewport row; measured in Chromium. - Claim: a finger catches a card that springs back or leaves. Verified in code (
shouldReceiveTouch); the browser cases were not run. - Claim: before, the card faded and shrank under the finger and faded out on dismiss. Verified against the base code and measured.
- Claim: with a fine pointer nothing changes. Verified: the fine-pointer swipe is unchanged; the only change is the Reduce Motion transition, from 0.01 ms to none, which looks the same.
- Claim: under Reduce Motion a touch screen fades in place, and a mouse or keyboard changes at once. Verified: the shared media keys and
reducedMotion.test.ts. - Claim: a finger on a toast never selects its text. Verified for the card's own text from touch-down (jsdom), except text inside its buttons or links; no device result.
.changeset/toast-swipe-follows-banner.md: non-blocking, omits the selection change.apps/sandbox/scripts/next-export-routes.json,caseIds.ts,cases.tsx,page.tsx,sandboxPages.ts,hydration-policy.ts,route-manifest.test.ts: clear.apps/storybook/stories/Toast.stories.tsx,Toast.doc.mjs: clear.docs/specs/AST-094-touch-presentations/spec.md,docs/specs/components/Toast/Toast.spec.md: on hold for owner approval.Toast.tsx: non-blocking comment at lines 481–482.ToastViewport.tsx: clear.useToastBannerSwipe.ts: blocking Effect at lines 249–259; its selection rule is on hold.motion/uikit/toast.ts: blocking, an unnamed internal module.motion/uikit/index.ts,motion/MEASUREMENTS.md,motion/README.md: clear.ToastViewport.test.tsx,toastSwipe.test.ts,toastSpringRows.test.ts: clear, passing.ToastCatch,ToastExitandToastSwipeScrollinteraction specs: clear on reading; not run.
| useIsomorphicLayoutEffect(() => { | ||
| // Under a finger the card moves by `translate` on every frame of a drag, | ||
| // so it keeps its own layer and no move repaints it. | ||
| const root = isNotification ? rootRef.current : null; | ||
| root?.style.setProperty('will-change', 'translate'); | ||
| return () => { | ||
| root?.style.removeProperty('will-change'); | ||
| // With a fine pointer the stylesheet's transitions run the card again. | ||
| root?.style.removeProperty('transition-property'); | ||
| }; | ||
| }, [isNotification, rootRef]); |
There was a problem hiding this comment.
This layout Effect names no external system (react-component-runtime INV3): it writes will-change: translate inline whenever isNotification, a pure function of the touch query. Put willChange: {default: null, '@media (pointer: coarse)': 'translate'} in Toast's styles.root, clear the inline transition-property where stillTransitions sets it (when that fade finishes, or in rest), and delete the Effect.
| * SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md and | ||
| * /packages/core/src/Toast/useToastBannerSwipe.ts. | ||
| */ | ||
|
|
There was a problem hiding this comment.
This is a new internal shared module (imported by Toast/useToastBannerSwipe.ts, re-exported from motion/uikit/index.ts) that no current record names, so it needs an owner API decision that says why existing modules are not enough. Toast's record at this head names it under Owns, so an owner's /approve-spec for this head settles it.
| // Still in the document (React detaches the ref on unmount) and | ||
| // not leaving. |
There was a problem hiding this comment.
Non-blocking (INV29): this comment restates the condition below it. Drop it.
There was a problem hiding this comment.
Changes requested for the three findings below. Approval also waits on an engineering owner deciding this preview's record changes (Toast FR4, FR5, DEC-1 and DEC-2, the touch-presentations FR4, FR7, FR36, FR38 and FR45 exceptions, and the new rule that any finger on a toast takes no text selection, so a long press on a phone can no longer select or copy toast text); an engineering owner records that decision by commenting /approve-spec with this pull request's full head SHA, and as an engineering owner the author may do so too.
motion/uikit/toast.tsis a new internal shared module (imported byToast/useToastBannerSwipe.ts) that no current record names, so it needs an owner API decision that shows its usage, why it is needed and why the existing UIKit tables are not enough; an owner's approval of this head's Toast record, which names it, settles this.- The layout Effect in
useToastBannerSwipe.ts(lines 249–259) writeswill-changeinline and names no external system; movewill-changeinto Toast's StyleX root style under the(pointer: coarse)media key, cleartransition-propertywhere the touch layer sets it, and delete the Effect. - The pull request states no Android emulator run (normal, animations removed, slow profile) or real iPhone run at this head, which the touch-presentations record requires for these touch claims, above all the slow-drag selection fix; add each result in the description as text.
Non-blocking: the changeset does not mention the new selection behavior, and the description names no component scope.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: under a finger the card waits 14 px, then follows at 0.55 with no jump. Verified:
followOffset,toastSwipe.test.ts, and a jsdom case. - Claim: a drag that turns back stretches the card and springs it back. Verified:
followOffsetandisDismissRelease, with a jsdom case. - Claim: a quick flick or a far enough drag dismisses, and anything else springs back. Verified:
isDismissReleaseand its recorded-release table. - Claim: every dismissal slides the card past its edge unfaded, then the row closes. Verified:
requestDismiss, the exiting effect and the viewport row; measured for the close button in Chromium. - Claim: a finger catches a card that springs back or leaves. Verified in code (
shouldReceiveTouch); the browser cases were not run. - Claim: before, the card faded and shrank under the finger and faded out on dismiss. Verified against the base code and measured.
- Claim: with a fine pointer nothing changes. Verified: the fine-pointer swipe is unchanged; the only change is the Reduce Motion transition, from 0.01 ms to none, which looks the same.
- Claim: under Reduce Motion a touch screen fades in place, and a mouse or keyboard changes at once. Verified: the shared media keys and
reducedMotion.test.ts. - Claim: a finger on a toast never selects its text. Verified for the card's own text from touch-down (jsdom, and a Chromium probe that is refused here and not on the base); text inside its buttons or links keeps its native behavior; no device result.
- Claim: this head merges the base branch and the toast change is the same. Verified: the patch differs only in context and table padding, and the merge keeps the base branch's content.
.changeset/toast-swipe-follows-banner.md: non-blocking, omits the selection change.apps/sandbox/scripts/next-export-routes.json,caseIds.ts,cases.tsx,page.tsx,sandboxPages.ts,hydration-policy.ts,route-manifest.test.ts: clear.apps/storybook/stories/Toast.stories.tsx,Toast.doc.mjs: clear.docs/specs/AST-094-touch-presentations/spec.md,docs/specs/components/Toast/Toast.spec.md: on hold for owner approval.Toast.tsx: non-blocking comment at lines 497–498.ToastViewport.tsx: clear.useToastBannerSwipe.ts: blocking Effect at lines 249–259; its selection rule is on hold.motion/uikit/toast.ts: blocking, an unnamed internal module.motion/uikit/index.ts,motion/MEASUREMENTS.md,motion/README.md: clear.ToastViewport.test.tsx,toastSwipe.test.ts,toastSpringRows.test.ts: clear, passing.ToastCatch,ToastExitandToastSwipeScrollinteraction specs: clear on reading; not run.
Preview only: this draft builds #8121 so that a finger on a toast never selects its text. The owners can try it before they decide. Do not merge; a maintainer closes it after the decision.
This head merges main (3e58ae0), so the preview builds on current main. The toast change is the same.