Skip to content

fix(BottomSheet): keep a caller's transition timing through a drag - #14221

Draft
vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:bottomsheet-caller-transition-timing
Draft

vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:bottomsheet-caller-transition-timing

Conversation

@vjeux

@vjeux vjeux commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

User impact

A caller can set a BottomSheet's transition timing with longhands, such as style={{transitionDuration: '410ms'}}, or with the transition shorthand. A drag broke both. Its transition: none reset a caller's longhands when the drag started, and React's removal of it cleared them when the drag ended. A caller's own shorthand replaced the drag's none, so the sheet animated under the finger. React also warned about the conflict, 102 times in the sheet's unit suite.

Problem and solution fit

  • Why it occurs: the drag suppresses transitions with the transition shorthand, merged before the caller's style.
  • Why it harms: setting the shorthand resets every longhand, and removing it clears them. React never writes them back. A caller's shorthand, the same key, wins instead.
  • Why it matters: the caller's timing is lost, or the sheet lags the finger.

Now the drag's suppression goes after the caller's style, in the caller's form: transition: 'none' over a shorthand, else transitionProperty: 'none'. It holds for the drag and leaves the caller's style as it was.

Expected behavior and authority

The hook says a drag moves the sheet live and turns off the panel's transition. No current record decides how that suppression meets a caller's transition style: the BottomSheet record's FR18, FR19 and FR27 and spec:AST-094 do not. This is flagged for the spec owners.

Smallest restoration

The gesture's transition becomes transitionProperty. Eight BottomSheet assertions, a gesture unit and a snapshot read transitionProperty now. A hidden browser fixture story sets a caller's longhands. There is no API, default or visual change.

Evidence

  • Reproduction before the change: at the first commit, the browser test fails in Chromium and WebKit, with both longhands empty after the drag. The shorthand unit case reads the caller's shorthand mid-drag, not none.
  • Result after the change: they pass. The BottomSheet suite passes 642 of 642, and React's conflict warnings drop from 102 to 0, counted on their full text.
  • Representative unchanged path: a sheet with no caller style suppresses its transitions mid-drag and keeps none at rest.
  • Regression test or other mutation-sensitive proof: both fail with main's code. Both unit cases also fail when the suppression merges before the caller's style.

Scope

Components: BottomSheet

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Of four open pull requests on these two files, one by another author also writes the sheet's inline transition-property, during a Reduce Motion cross-fade. Trial merges add no conflict.

Testing

  • Head 71495b6 on main b2914af, in two commits. Red first: 5cae53a adds two unit cases, the fixture story and the browser test alone. There, both unit cases fail, and the browser test fails in Chromium and WebKit. The longhand case fails because jsdom does not expand the shorthand.
  • Core's typecheck reports 0 errors, and strict ESLint passes on the changed files. Prettier passes with --ignore-path /dev/null --check on them, and a misformatted control file in the same run fails.
  • Units: BottomSheet and keyboard, 837 of 837 in 24 files.
  • Browser, Chromium and WebKit: the new test, the BottomSheet interaction tests and the six keyboard tests. Chromium passes 79, with 1 skipped; WebKit passes 61, with 19 skipped. Each skip is a test's own engine-only case.
  • pnpm check:knowledge, check:changesets, check:repo and review:pre pass.

Drafted with an AI coding agent; the tests were run as described.

vjeux added 2 commits December 2, 2026 09:35
A caller may set the sheet's transition timing with longhands, such as transitionDuration, or with the transition shorthand. Unit cases check that a drag's suppression holds over either form, and that the caller's form is back at rest. A Chromium and WebKit case, on a new browser fixture story, reads the longhands after a real touch drag and its settle. They fail until the next commit.
The drag suppressed the sheet's transitions with the transition shorthand, merged before the caller's style. Its reset cleared a caller's longhands, and React never wrote them again. A caller's own shorthand replaced the suppression for the whole drag. React also warned about the conflict.

The gesture now suppresses through transition-property, only while it suppresses. The panel writes the suppression after the caller's style, in the caller's own form: the shorthand over a caller's shorthand, else the longhand. So it holds while the drag lasts and leaves the caller's style alone.
@vercel

vercel Bot commented Dec 3, 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 Dec 3, 2026 3:18am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 3, 2026
@astracat-bot

astracat-bot Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Dec 3, 2026, 3:37 AM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the fix keeps timing for callers who set transition longhands alone or the transition shorthand alone, but a caller who sets both loses the longhand after a drag.

  • Shorthand plus longhand loses timing: with style={{transition: 'transform 300ms linear', transitionDuration: '410ms'}}, the shorthand branch's transition: 'none' (BottomSheetPanel.tsx:1272-1273) resets the longhand and only the shorthand is written back, so after one drag the sheet settles at 300ms instead of 410ms and React logs its shorthand/longhand warning (reproduced locally with a touch drag in Chromium), which makes the title, the changeset's first and last sentences and the description's "leaves the caller's style as it was" untrue; either drop the caller's transition* longhands from the merged style while the suppression holds and add a case for that form, or narrow those claims to longhands alone or the shorthand alone.

Two changed comments could follow the source-comment rules more closely: BottomSheetPanel.tsx:1266-1268 restates the merge order without its reason, and the changed sentence at useSheetGestures.ts:2054-2059 runs to 36 words; rewrites are suggested inline. Everything else checked out locally: both new unit cases fail on the base and pass here, the BottomSheet suite passes 642 of 642 without React's conflict warnings, and a real Chromium drag keeps longhand-only and shorthand-only timing and no longer animates a shorthand-styled sheet under the finger.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims
    • Title, the sheet keeps a caller's transition timing through a drag: false for a caller who sets the shorthand with a longhand (local Chromium drag).
    • Changeset, timing kept with longhands or with the shorthand: false for the same caller.
    • Changeset, before the fix a drag cleared longhands and a caller's shorthand turned the suppression off: verified (local Chromium drag on the base).
    • Changeset, React no longer warns about the shorthand beside the longhands: verified for the BottomSheet suite (102 warnings on the base, none here); false for a caller who sets both forms.
    • Description, user impact (longhands reset at the drag's start and cleared at its end, a caller's shorthand animating under the finger, 102 warnings in the suite): verified locally.
    • Description, the suppression goes after the caller's style in the caller's form: verified (BottomSheetPanel.tsx:1269-1275, :1312); that it leaves the caller's style as it was: false for the shorthand-plus-longhand caller.
    • Description, the hook says a drag turns off the panel's transition: verified (useSheetGestures.ts:2041-2063); that no current record decides the interaction: not adopted, since the public component API's preserved-consumer-props invariant and the touch spec's finger-tracking requirement cover it.
    • Description, the gesture writes transitionProperty, eight sheet assertions, a gesture unit and a snapshot read it, and a hidden fixture story sets longhands: verified.
    • Description, no API, default or visual change: verified (API surface comparison, unchanged default path, identical frames at rest).
    • Description, red-first unit cases fail at the first commit and pass at the head: verified locally; the browser test's red and green runs in Chromium and WebKit: reported.
    • Description, 642 of 642 in the BottomSheet suite and the unchanged no-style path: verified locally; unit cases failing when the suppression merges first: reported.
    • Description, typecheck, strict ESLint and Prettier: verified locally; 837 of 837 with the keyboard suite, the browser pass counts, and the knowledge, changeset, repository and pre-review checks: reported.
    • Description, scope checklist (one component, no tagalongs, no new API or default, no internal context): verified; four open pull requests on these files with clean trial merges: reported.
  • Files
    • .changeset/bottomsheet-caller-transition-longhands.md: finding (claim)
    • apps/storybook/stories/BottomSheet.stories.tsx: clear
    • packages/core/src/BottomSheet/BottomSheet.test.tsx: clear
    • packages/core/src/BottomSheet/BottomSheetPanel.tsx: finding (shorthand branch), comment suggestion
    • packages/core/src/BottomSheet/BottomSheetResizeDuringSettle.test.tsx: clear
    • packages/core/src/BottomSheet/__tests__/BottomSheetCallerTransition.interaction.browser.spec.ts: clear
    • packages/core/src/BottomSheet/useSheetGestures.test.ts: clear
    • packages/core/src/BottomSheet/useSheetGestures.ts: comment suggestion

Automated review (maintainer link)

const dragSuppression =
isInteractive && suppression != null
? style?.transition != null
? {transition: suppression}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the caller sets transition together with a longhand (say transitionDuration: '410ms'), this branch writes only transition: 'none'. That resets the longhand, and when the drag ends React writes back only the shorthand, so the sheet settles at the shorthand's 300ms from then on, with React's shorthand/longhand warning (reproduced locally with a touch drag in Chromium).

One fix: while the suppression holds, also set each transition* longhand key the caller's style has to undefined, so React writes the shorthand and then those longhands back when the drag ends, and add a case for that form. Otherwise, narrow the title, changeset and description to longhands alone or the shorthand alone.

Comment on lines +1266 to +1268
// The drag's suppression goes after the caller's style, in the caller's own
// form: the shorthand over a caller's shorthand, else the longhand. It holds
// during the drag. After the drag, the caller's style is unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this restates the merge order the code shows and leaves out why. A rewrite that keeps only the reason:

// A shorthand write resets every transition longhand, and its removal clears
// them. So the suppression comes last, in the caller's form: the shorthand
// over a caller's shorthand, else `transition-property`.

Comment on lines 2054 to +2059
// would apply to that transform too, cutting the exit. Reduced motion
// is the panel's own stylesheet's to honor (its transform transition
// collapses under the preference), not an inline `none` here: the
// shorthand would also silence the panel's opacity transition, the
// reduced-motion cross-fade on a coarse pointer.
transition:
// collapses under the preference), not an inline `none` here: that
// would also silence the panel's opacity transition, the
// reduced-motion cross-fade on a coarse pointer. The longhand leaves
// a caller's own transition timing alone.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: the changed sentence from "Reduced motion" on runs to 36 words, over the 25-word limit for source comments. A split:

// The panel's stylesheet honors reduced motion: its transform transition
// collapses under the preference. An inline `none` here would also stop the
// opacity cross-fade on a coarse pointer. The longhand keeps a caller's
// transition timing.

This branch was successfully deployed

1 active deployment
Preview — 71495b64 Deployed Dec 3, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant