Repository navigation
fix(BottomSheet): a scrim press dismisses only when it starts and ends on the scrim (#11589) - #11611
Conversation
…s on the scrim (meta#11589) meta#11589. A BottomSheet with purpose="info" and a BottomSheetSwitcher step with its scrim closed on any click whose target was the <dialog>. A press that starts inside the sheet and ends on the scrim (such as a text selection or a slider drag released past the edge) also produces that click, because the browser sends it to the common ancestor, so the sheet closed and what the person was doing was lost. Specs' ruling, one shared path: Layer/useBackdropPress records pointer-down and pointer-up on the dialog and dismisses on the click only when both landed on the backdrop; BottomSheet and BottomSheetSwitcher now adopt useBackdropPress, matching Dialog and Drawer. Record: family:overlay-dismissal FR10 states the rule and includes BottomSheet and BottomSheetSwitcher. Tests: useBackdropPress.test.tsx covers BottomSheet and BottomSheetSwitcher across mouse, touch, cancelled pointers, and nested layers; unit tests cover edge crossings; and BackdropPress.a11y.chromium.spec.ts includes both surfaces.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and four blocking issues need changes.
This pull request extends the overlay-dismissal family's backdrop-press rule (FR10), which today names only Dialog, Drawer and CommandPalette, to BottomSheet with purpose="info" and to BottomSheetSwitcher steps; through AV4 it also makes a scrim press with a menu open inside a sheet close only the menu. An engineering owner approves or rejects that extension by commenting /approve-spec <full head SHA> on this pull request (the author may do so if they are an engineering owner).
Blocking:
- Seven existing Core tests now fail because they click the sheet's
<dialog>withoutpointerdownandpointerup(BottomSheetStacking.test.tsx:1023,DateTimeInputTouch.test.tsx:559,MultiSelector.test.tsx:238and:263,PopoverPresentation.test.tsx:550,PowerSearchBottomSheet.test.tsx:3981and:4050), so send both pointer events before each scrim click, asBottomSheet.test.tsxnow does. - The Chromium spec's "with a menu open inside" loop (
BackdropPress.a11y.chromium.spec.ts:146-152) now runs for BottomSheet and BottomSheetSwitcher, but the story's sheets render noActionsmenu, so four tests time out unless both sheets inBackdropPressA11y.stories.tsxget theDropdownMenuor leave that loop. - The new
family:overlay-dismissalandFR10citations in the comments atBottomSheet.tsx:862andBottomSheetSwitcher.tsx:1004make the comment-provenance baseline check fail; please remove them. - Desktop behavior change needs an owner decision: for mouse and trackpad users, a press that starts in a sheet and ends on the scrim no longer closes it, and a scrim press with a menu open inside closes only the menu (
BottomSheet.tsx:866-869,BottomSheetSwitcher.tsx:1008-1011).
If the extension is approved, FR11's text and verification row, the changeset, and the file headers of the story and the Chromium spec should also name the sheets.
Claims and files checked
- Claim: sheets closed when a press started inside and was released on the scrim. Verified: in Chromium the base sheet closes on that mouse drag, and the new tests fail on the base.
- Claim: the shared hook dismisses only when the press starts and ends on the backdrop, and a cancelled pointer clears it. Verified at
useBackdropPress.ts:66-113and by the new rows inuseBackdropPress.test.tsx. - Claim: this brings sheets in line with Dialog and Drawer. Verified: the wiring matches
Dialog.tsx:956-970andDrawer.tsx:620-637. - Claim: FR10 now names the sheets. Verified at
docs/families/overlay-dismissal.md:229-231and:323; this is the change awaiting an owner. - Claim: the tests in three files are updated, and 287 of 287 pass. Verified at head (162 + 54 + 71).
- Claim: the story and the Chromium spec are updated. Partly false: four of the new Chromium rows cannot pass.
- Claim: a patch changeset is added. Verified.
- Claim: after the change the sheet stays open, and a press on the scrim alone still closes it. Verified in Chromium with a mouse, and with a finger in the unit tests.
- Claim: swipe-to-dismiss is unaffected. Verified: the swipe path is unchanged and the drag tests pass.
- Claim: the shared hook's test file has 71 matrix tests. Verified.
- Claim: typecheck, knowledge and changeset checks pass. Core's build typecheck and both checks pass at head; the repository-wide typecheck and the pre-review script were not run.
- Claim: no new interaction model is hidden under the fix label. Partly false: a scrim press with a menu open inside a sheet now leaves the sheet open, and this is not stated.
- Changeset: sheets close only on a press that starts and ends on the scrim. Verified.
- Changeset: selecting text or dragging a control past the edge no longer closes the sheet. Verified with a mouse in Chromium.
- Changeset: a press on the scrim alone still closes the sheet with a mouse, a pen or a finger. Verified for mouse and finger; pen uses the same pointer path.
.changeset/bottom-sheet-scrim-press-start-end.md: clear (narrower than the change).apps/storybook/stories/BackdropPressA11y.stories.tsx: the sheets lack theActionsmenu the spec expects, and the header is stale.docs/families/overlay-dismissal.md: the FR10 edit awaits an owner, and FR11 is not updated.packages/core/src/BottomSheet/BottomSheet.test.tsx: clear.packages/core/src/BottomSheet/BottomSheet.tsx: the record citation at line 862 fails the provenance baseline.packages/core/src/BottomSheet/BottomSheetSwitcher.test.tsx: clear.packages/core/src/BottomSheet/BottomSheetSwitcher.tsx: the record citation at line 1004 fails the provenance baseline.packages/core/src/BottomSheet/BottomSheetSwitcherContext.ts: clear.packages/core/src/Layer/__tests__/BackdropPress.a11y.chromium.spec.ts: the menu loop now includes sheets with no menu, and the header is stale.packages/core/src/Layer/useBackdropPress.test.tsx: clear.packages/core/src/Layer/useBackdropPress.ts: clear.
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
…ts and lint Tests that pressed a sheet's scrim with a bare click now send the whole press (pointer down, pointer up and click on the dialog), in BottomSheet, BottomSheetSwitcher, BottomSheetStacking and Popover's sheet. The source comments drop their record citations, and the switcher reads the backdrop press handlers one by one so its memoized handlers list their real dependencies. The useBackdropPress header comment is left as it was. Co-authored-by: Muhammad Ausaf Jamal <[email protected]>
|
/approve-spec 6f962e4 |
There was a problem hiding this comment.
Thanks for this fix. The spec question is settled: an engineering owner approved extending the backdrop-press rule (FR10) to BottomSheet with purpose="info" and BottomSheetSwitcher steps for this head. Three things still need changes before this can be approved:
- Five existing Core tests that send a bare
click(or apointerdownwith nopointerup) to a sheet's dialog now fail (DateTimeInputTouch.test.tsx:559,MultiSelector.test.tsx:238and:263,PowerSearchBottomSheet.test.tsx:3981and:4050), so send the whole press there, as yourpressScrimhelper does. - The new Chromium "with a menu open inside" tests for BottomSheet and BottomSheetSwitcher (
BackdropPress.a11y.chromium.spec.ts:146-152) look for anActionsbutton that the story's sheets never render, so add<DropdownMenu button={{label: 'Actions'}} items={menuItems} />to both sheets inBackdropPressA11y.stories.tsx, or leave the sheets out of that loop. - This changes what a mouse or trackpad does, so the description needs desktop before-and-after results: what
maindoes and what this change does for a mouse press from the field released over the scrim, and for a scrim click while a menu is open inside the sheet.
Non-blocking: the changeset could say that a scrim press with a menu or popover open inside a sheet now closes only that layer, and "Bare clicks on the scrim still close the sheet" reads more accurately as "a press on the scrim alone still closes the sheet". The comment-provenance check passes now.
Claims and files checked
- Claim: an
infosheet and a switcher step close on a scrim press only when it starts and ends on the scrim — verified (BottomSheet.tsx:866-869,BottomSheetSwitcher.tsx:1008-1063, new unit tests; they fail againstmain). - Claim: a text selection or drag released past the sheet's edge no longer closes it — verified in Chromium (closes on
main, stays open with the selection here). - Claim: a press on the scrim alone still closes it with a mouse, pen or finger — verified when nothing is open inside the sheet; with a menu open, the first press closes only the menu (non-blocking note).
- Claim: on
mainthe click of an edge-crossing press reaches the dialog and closes the sheet — verified (oldhandleClick; Chromium). - Claim: the shared hook needs pointer down and up on the dialog, and a cancelled pointer ends the press — verified (
useBackdropPress.ts:66-91). - Claim: both hosts, the family record, the tests, the story, the Chromium spec and a patch changeset were updated — verified; four of the new Chromium tests cannot pass (above).
- Claim: swipe-to-dismiss is unaffected — verified (the panel's
onDismissis unchanged and the BottomSheet suite passes). - Claim: bare clicks on the scrim still close the sheet — true for a real click; false for a click event with no press (above).
- Claim: the three named test files pass (287 tests, 71 in the hook matrix) — verified.
- Claim: Core type checking, the knowledge and changeset checks, and the pre-review report pass — verified.
- Claim: no new public API, visuals or defaults — verified (API surface unchanged); the menu-inside interaction change is not described (non-blocking note).
- Claim: the follow-up commit updates the remaining sheet tests, drops record citations from comments, lists real memo dependencies and leaves
useBackdropPress.tsuntouched — verified. - Files:
BottomSheet.tsx,BottomSheetSwitcher.tsx,BottomSheetSwitcherContext.ts,BottomSheet.test.tsx,BottomSheetStacking.test.tsx,BottomSheetSwitcher.test.tsx,useBackdropPress.test.tsx,PopoverPresentation.test.tsx— clear. - Files:
BackdropPress.a11y.chromium.spec.ts,BackdropPressA11y.stories.tsx— the Chromium menu tests above. - Files:
docs/families/overlay-dismissal.md— approved; FR11's verification row could also name the sheets (non-blocking)..changeset/bottom-sheet-scrim-press-start-end.md— the non-blocking note above.
…tests; hold a menu in the story's sheets DateTimeInput's touch sheet, MultiSelector's bottom sheet and PowerSearch's sheet flow pressed the scrim with a bare click or with no pointer up; they now send pointer down, pointer up and click on the dialog. The backdrop-press story's BottomSheet and BottomSheetSwitcher step hold the same Actions menu as Dialog and Drawer, so the Chromium menu-inside checks reach it. The changeset says that a scrim press with a menu open inside closes only the menu. Co-authored-by: Muhammad Ausaf Jamal <[email protected]>
|
/approve-spec 8457e54 |
There was a problem hiding this comment.
Almost there: the Core tests, the story's Actions menu and the changeset are fixed, and an engineering owner approved the FR10 change for this head, so only the pull request description still needs a change.
- This changes what a mouse or trackpad does, so the description needs desktop before-and-after results in its own words, for example: with a mouse in Chromium at 1024 × 768,
maincloses the sheet on a press from its field released over the scrim while this change keeps it open with the text selected, and with a menu open inside the sheetmaincloses the menu and the sheet on one scrim click while this change closes only the menu and the next click closes the sheet.
Non-blocking: FR11's verification row in docs/families/overlay-dismissal.md could also name the two sheets, and "Bare clicks on the scrim still close the sheet" reads more accurately as "a press on the scrim alone still closes the sheet". Editing the description is enough; no new commit is needed.
Claims and files checked
- Changeset: an
infosheet and a switcher step close on a scrim press only when it starts and ends on the scrim — verified (BottomSheet.tsx:866-869,BottomSheetSwitcher.tsx:1013-1016; the new unit tests fail againstmainand pass here). - Changeset: a text selection or drag released past the sheet's edge no longer closes it — verified in Chromium for a text selection (closes on
main, stays open with the selection here); a slider drag takes the same path. - Changeset: a press on the scrim alone still closes it with a mouse, a pen or a finger — verified for mouse and finger in Chromium; pen uses the same pointer events.
- Changeset: with a menu or popover open inside, a scrim press closes only that layer and the next closes the sheet — verified (Chromium menu tests, popover unit tests).
- Description: on
main, a press from inside released over the scrim closes the sheet because the click reaches the dialog — verified (old click handler; Chromium onmain). - Description: the shared hook needs pointer down and up on the dialog, and a cancelled pointer ends the press — verified (
useBackdropPress.ts:66-91). - Description: the same rule already covers Dialog, Drawer and CommandPalette — verified (the earlier fix is in history; the record's FR10).
- Description: both hosts, the family record, the tests, the story, the Chromium spec and a patch changeset were updated — verified.
- Description: after the change the sheet stays open with the selection, and a scrim-only press still closes it — verified in Chromium.
- Description: swipe-to-dismiss is unaffected — verified (the panel's dismiss callback is unchanged and the BottomSheet suite passes).
- Description: bare clicks on the scrim still close the sheet — true for a real click; false for a click event with no press (non-blocking wording).
- Description: the edge-crossing regression tests and the backdrop-press matrix — verified (26 of them fail against
main; all pass here). - Description: the three named test files pass (287 tests) — verified.
- Description: Core type checking, the knowledge check and the changeset check pass — verified.
- Description: the pre-review report has no findings — verified (0 findings, 404 authored lines).
- Description: no new public API, visuals or defaults — verified (API surface unchanged); the menu-case interaction is now in the changeset.
- Description: the maintainer commit updates six more sheet tests and the Popover sheet test, drops record citations from comments, lists real memo dependencies and leaves
useBackdropPress.tsuntouched — verified. - Description: Popover's sheet still closes on a scrim tap with
hasLightDismiss={false}, and the switcher dismisses only from the active sheet's dialog — verified (both tests pass). - Description: desktop before-and-after results for mouse or trackpad — missing (above).
- Files:
BottomSheet.tsx,BottomSheetSwitcher.tsx,BottomSheetSwitcherContext.ts— clear. - Files:
BottomSheet.test.tsx,BottomSheetStacking.test.tsx,BottomSheetSwitcher.test.tsx,useBackdropPress.test.tsx,DateTimeInputTouch.test.tsx,MultiSelector.test.tsx,PopoverPresentation.test.tsx,PowerSearchBottomSheet.test.tsx— clear (all sheet-related Core tests pass). - Files:
BackdropPress.a11y.chromium.spec.ts,BackdropPressA11y.stories.tsx— clear (32 of 32 Chromium tests pass). - Files:
.changeset/bottom-sheet-scrim-press-start-end.md— clear. - Files:
docs/families/overlay-dismissal.md— approved; the FR11 row note above (non-blocking).
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. This pull request is still a draft, so CI starts when it is marked ready for review; it already carries the ci:run label a fork needs. An engineering owner approved the FR10 change for this exact head, the description now gives the desktop before-and-after results, and they match what the review measured.
Non-blocking:
- FR11's verification row in
docs/families/overlay-dismissal.mdcould also name the two sheets, since the unit and Chromium tests now cover them with a menu or popover open inside. - "Bare clicks on the scrim still close the sheet" reads more accurately as "a press on the scrim alone still closes the sheet", because a
clickevent with no pointer down and up no longer closes it. - Miss: the changed comment above
handleScrimPressinBottomSheetSwitcher.tsxpacks three topics into a 27-word sentence; a suggested rewrite is on the line.
Claims and files checked
- Changeset: an
infosheet and a switcher step close on a scrim press only when it starts and ends on the scrim — verified (BottomSheet.tsx:863-869,BottomSheetSwitcher.tsx:1005-1016; the new unit tests fail against the base and pass here). - Changeset: a text selection or a drag released past the sheet's edge no longer closes it — verified in Chromium for a text selection (closes on the base, stays open with the selection here); a slider drag takes the same path.
- Changeset: a press on the scrim alone still closes it with a mouse, a pen or a finger — verified for mouse and finger in Chromium; a pen goes through the same pointer events, and the hook does not read the pointer type.
- Changeset: with a menu or popover open inside, a scrim press closes only that layer and the next closes the sheet — verified (Chromium menu tests, popover unit tests).
- Description: on
main, a press from inside released over the scrim closes the sheet because its click reaches the dialog — verified (the removed click handler; Chromium on the base code). - Description: the shared hook needs pointer down and up on the dialog, and a cancelled pointer ends the press — verified (
useBackdropPress.ts:66-91). - Description: the same rule already covers Dialog, Drawer and CommandPalette (#9613) — verified (history and FR10).
- Description: both hosts, the family record, the tests, the story, the Chromium spec and a patch changeset were updated — verified.
- Description: after the change the sheet stays open with the selection, and a press on the scrim alone still closes it — verified in Chromium.
- Description: swipe-to-dismiss is unaffected — verified (the panel's dismiss callback is unchanged and the BottomSheet suite passes).
- Description: bare clicks on the scrim still close the sheet — true for a real click; a click event with no press no longer does (non-blocking wording above).
- Description: the edge-crossing regression tests and the 71-test backdrop-press matrix — verified (71 tests; 26 of the new rows fail against the base).
- Description: the three named test files pass (287 tests) — verified.
- Description: Core type checking passes over 1,201 source files, and the knowledge and changeset checks pass — verified.
- Description: the pre-review report has no findings — verified (0 findings, 404 authored lines).
- Description: no new public API, visuals or defaults, and no internal context in public text — verified (public API surface unchanged).
- Description: desktop before and after with a mouse at 1280 × 800 — on
maina selection released over the scrim closes the sheet and the step and a scrim click with the menu open closes both; here they stay open with the selection, the first click closes only the menu and the second closes the host — verified (Chromium at 1280 × 800 on both trees; the story's note is 64 characters). - Description: the maintainer commit sends the whole press in six more sheet tests and Popover's sheet test, drops record citations from comments, lists real memo dependencies and leaves
useBackdropPress.tsunchanged — verified. - Description: Popover's sheet still closes on a scrim tap with
hasLightDismiss={false}, and the switcher dismisses only from the active sheet's dialog — verified (both tests pass). - Description: the affected suites pass — verified (80 sheet-related Core test files pass here; the description's 61-file selection was not reproduced exactly).
- Description: a second carry commit sends the whole press in five more Core tests and adds the Actions menu to the story's sheets — verified (six tests changed; the sixth already passed).
- Files:
BottomSheet.tsx,BottomSheetSwitcher.tsx,BottomSheetSwitcherContext.ts— clear, apart from the comment wording note above. - Files:
BottomSheet.test.tsx,BottomSheetStacking.test.tsx,BottomSheetSwitcher.test.tsx,useBackdropPress.test.tsx,DateTimeInputTouch.test.tsx,MultiSelector.test.tsx,PopoverPresentation.test.tsx,PowerSearchBottomSheet.test.tsx— clear (all pass). - Files:
BackdropPress.a11y.chromium.spec.ts,BackdropPressA11y.stories.tsx— clear (all 32 Chromium tests pass). - Files:
.changeset/bottom-sheet-scrim-press-start-end.md— clear. - Files:
docs/families/overlay-dismissal.md— approved; the FR11 row note above (non-blocking).
|
/approve-spec 4d013c7 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this commit yet, because its workflow runs are waiting for a maintainer to approve them (the ci:run label is already on).
Both sheet scrims now follow the shared backdrop-press rule, and an engineering owner approved the family:overlay-dismissal FR10 change for this commit. The new tests fail on the previous code and pass here, in unit tests and in Chromium.
Optional follow-up, not blocking, already tracked in #13511:
- In
BottomSheetSwitcher.tsx(lines 1073-1074), "The click handler still checks for the active dialog" restates the code and names one handler where all four check; "Each handler still checks for the active dialog" is enough.
Claims and files checked
Review mode: full; reason: merge-touches-pr-files
- Changeset: an info sheet and a switcher step close on a scrim press only when the press starts and ends on the scrim. Verified (
BottomSheet.tsx:878-884,:948-951;BottomSheetSwitcher.tsx:1076-1134); the new tests fail on the previous code and pass here. - Changeset: selecting text or dragging a control past the sheet's edge no longer closes it. Verified in Chromium for a text selection, which stays selected; a control drag ends on the same pointer-up check.
- Changeset: a press on the scrim alone still closes the sheet with a mouse, a pen or a finger. Verified for a mouse click and a finger tap in Chromium; the shared hook does not read the pointer type, so a pen takes the same path.
- Changeset: with a menu or popover open inside, a scrim press closes only that layer and the next one closes the sheet. Verified (the hook's popover rows; Chromium with the Actions menu open, focus left in the sheet).
- Description: the cause (the click goes to the dialog as the nearest common ancestor) and the fix through the shared hook, with a cancelled pointer ending the press. Verified (
useBackdropPress.ts:38-56,:87-91). - Description: FR10 as the expected behavior, with the earlier Dialog, Drawer and CommandPalette fix as precedent. Verified: the precedent fix is on
main, and the FR10 edit is owner-approved for this commit. - Description: the smallest-restoration file list, the reproduction and the result after the change. Verified against the 15 changed files and in Chromium on this commit.
- Description: swipe to dismiss is unchanged, and a plain scrim click still closes the sheet. Verified (the panel and its dismiss path are unchanged; swipe tests pass; Chromium scrim click closes). A synthetic click with no pointer events no longer closes, which is why seven test files now send the whole press.
- Description: the regression tests, 71 hook matrix tests, and 291 of 291 in the three suites. Verified (71; 162 + 58 + 71 pass).
- Description: Core type check, knowledge check, changeset check, and a pre-review report with no findings. Verified on this commit.
- Description: one defect, no hidden public API, visual, default or interaction-model change, and no internal context in public text. Verified: the built API surfaces show no change, and the public text is clean.
- Description: desktop mouse before and after for the sheet and the switcher step (a text selection released on the scrim; a scrim click with the menu open, then a second one). Verified by browser checks on this commit.
- Description: the maintainer carry (whole-press tests, source comments without record citations, handlers read one by one, the hook file unchanged, Popover's sheet still closing on a scrim tap with
hasLightDismiss={false}, the switcher dismissing only from the active step, the story's Actions menu, a last commit of comments and records only, and a clean merge ofmain). Verified; the affected suites pass on this commit. - Description: a review suggestion deferred to #13511, and the fix for #11589. Verified: #13511 tracks the comment wording above, and #11589 reports this defect.
- Files: the changeset, the story,
overlay-dismissal.md,BottomSheet.tsx,BottomSheetSwitcherContext.ts, the Chromium spec and the eight unit test files: clear.BottomSheetSwitcher.tsx: the non-blocking comment note above.
|
/approve-spec 9510918 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this commit yet, because the pull request is still a draft and its workflow runs wait for a maintainer to approve them (the ci:run label is already on).
Both sheet scrims now follow the shared backdrop-press rule, and an engineering owner approved the family:overlay-dismissal FR10 change for this commit. The new tests fail on the previous code and pass here, in unit tests and in Chromium.
Optional follow-up, not blocking, already tracked in #13511:
- In
BottomSheetSwitcher.tsx(lines 1073-1074), "The click handler still checks for the active dialog" restates the code and names one handler where all four check; "Each handler still checks for the active dialog" is enough.
Claims and files checked
Review mode: full; reason: other:cited-record-changed-on-main
- Changeset: an info sheet and a switcher step close on a scrim press only when the press starts and ends on the scrim. Verified (
BottomSheet.tsx:876-884,:948-951;BottomSheetSwitcher.tsx:1071-1134); the new tests fail on the previous code and pass here. - Changeset: selecting text or dragging a control past the sheet's edge no longer closes it. Verified in Chromium for a text selection, which stays selected; a control drag ends on the same pointer-up check.
- Changeset: a press on the scrim alone still closes the sheet with a mouse, a pen or a finger. Verified for a mouse click and a finger tap in Chromium; the shared hook does not read the pointer type, so a pen takes the same path.
- Changeset: with a menu or popover open inside, a scrim press closes only that layer and the next one closes the sheet. Verified (the hook's popover rows; Chromium with the Actions menu open, focus left in the sheet).
- Description: the cause (the click goes to the dialog as the nearest common ancestor) and the fix through the shared hook, with a cancelled pointer ending the press. Verified (
useBackdropPress.ts:38-56,:87-91). - Description: FR10 as the expected behavior, with the earlier Dialog, Drawer and CommandPalette fix as precedent. Verified: Dialog and Drawer call the shared hook on
main, and the FR10 edit is owner-approved for this commit. - Description: the smallest-restoration file list, the reproduction and the result after the change. Verified against the 15 changed files and in Chromium on this commit.
- Description: swipe to dismiss is unchanged, and a plain scrim click still closes the sheet. Verified (the panel and its dismiss path are unchanged; swipe tests pass; a Chromium scrim click closes). A synthetic click with no pointer events no longer closes, which is why seven test files now send the whole press.
- Description: the regression tests, 71 hook matrix tests, and 291 of 291 in the three suites. Verified (71; 162 + 58 + 71 pass).
- Description: Core type check, knowledge check, changeset check, and a pre-review report with no findings. Verified on this commit.
- Description: one defect, no hidden public API, visual, default or interaction-model change, and no internal context in public text. Verified: the built API surfaces show no change, and the public text is clean.
- Description: desktop mouse before and after for the sheet and the switcher step (a text selection released on the scrim; a scrim click with the menu open, then a second one). Verified by browser checks on this commit.
- Description: the maintainer carry (whole-press tests, source comments without record citations, handlers read one by one, the hook file unchanged, Popover's sheet still closing on a scrim tap with
hasLightDismiss={false}, the switcher dismissing only from the active step, the story's Actions menu, a commit of comments and records only, and clean merges ofmain). Verified; the affected suites pass on this commit. - Description: a review suggestion deferred to #13511, and the fix for #11589. Verified: #13511 tracks the comment wording below, and #11589 reports this defect.
- Files: the changeset, the story,
overlay-dismissal.md,BottomSheet.tsx,BottomSheetSwitcherContext.ts, the Chromium spec and the eight unit test files: clear.BottomSheetSwitcher.tsx: the non-blocking comment note above.
|
(Posted by Cindy's agent.) Merged, thank you @MuhammadAusafJamal, and thanks for checking it on your own Pixel along the way! A sheet now closes on a scrim press only when the press starts and ends on the scrim, so a drag released past the sheet's edge no longer closes it by accident. It ships in the next release, with you credited. |
User impact
A
BottomSheetwithpurpose="info"(default) or aBottomSheetSwitcherstep closed when a pointer press started inside the sheet (such as selecting text in a field or dragging a slider thumb) and released on the scrim past the sheet's top edge. What the user was doing was lost. This restoration prevents unintended dismissal when a press crosses the sheet's edge, bringing sheet backdrop dismissal into consistency withDialogandDrawer.Problem and solution fit
<dialog>element receivesclickevents whenevent.target === event.currentTarget. When a press begins on a child element inside the sheet panel and releases over the backdrop outside, the browser routes the resultingclickto their nearest common ancestor—the<dialog>itself.Layer/useBackdropPressensures that dismissal occurs only when both pointer-down and pointer-up events land on the<dialog>backdrop directly. Pointer cancellation or crossing edges clears the press state without triggering close.Expected behavior and authority
family:overlay-dismissalFR10: A backdrop press dismisses only when the press both started and ended on the backdrop. A press that crosses the member's edge either way does not dismiss it, and a cancelled pointer ends the press.Dialog,Drawer, andCommandPaletteviaLayer/useBackdropPress.Smallest restoration
packages/core/src/BottomSheet/BottomSheet.tsx, wireduseBackdropPressto the standalone<dialog>root.packages/core/src/BottomSheet/BottomSheetSwitcher.tsx, wireduseBackdropPressto the host dialog and forwarded pointer capture handlers viaBottomSheetSwitcherContextto step<dialog>elements.docs/families/overlay-dismissal.md, updated FR10 to includeBottomSheet(purpose="info") andBottomSheetSwitcherstep scrims.BottomSheet.test.tsx,BottomSheetSwitcher.test.tsx, anduseBackdropPress.test.tsx.BackdropPressA11y.stories.tsxand Playwright specBackdropPress.a11y.chromium.spec.ts..changeset/bottom-sheet-scrim-press-start-end.md.Evidence
BottomSheetwith aTextInput, pressing inside the text field, dragging up, and releasing over the scrim dispatchedclickto<dialog>, dismissing the sheet (onOpenChange(false)).BottomSheetPanelremains handled by touch gesture tracking and is unaffected. Bare clicks on the scrim still close the sheet.packages/core/src/BottomSheet/BottomSheet.test.tsx: Edge crossing tests verify sheet stays open when press starts inside and ends on scrim, or starts on scrim and ends inside.packages/core/src/BottomSheet/BottomSheetSwitcher.test.tsx: Switcher edge crossing tests verify step stays open when press crosses active dialog boundary.packages/core/src/Layer/useBackdropPress.test.tsx: 71 matrix tests across all members (mouse, touch, cancelled pointers, nested layers, popovers).Writing rubric results
Scope
Components: BottomSheet, BottomSheetSwitcher, Layer
Testing
pnpm vitest run packages/core/src/BottomSheet/BottomSheet.test.tsx packages/core/src/BottomSheet/BottomSheetSwitcher.test.tsx packages/core/src/Layer/useBackdropPress.test.tsx(291/291 passed)pnpm -F @astryxdesign/core typecheck(passed, 0 errors across 1,239 files)pnpm check:knowledge(passed)pnpm check:changesets(passed)pnpm review:pre(0 findings)Fixes #11589
Desktop before and after
Real Chrome at 1280 by 800 with a mouse, on the backdrop-press story (
A11y / BackdropPress / Members). Before:mainwith this pull request's story. After: this head (8457e54).With a mouse in Chromium at 1280 by 800,
maincloses a BottomSheet when a press that selects the text in its field is released over the scrim, and the selection is lost; this change keeps the sheet open with the text still selected. The same holds for a BottomSheetSwitcher step. With the sheet's Actions menu open, a scrim click onmaincloses the menu and the sheet together; with this change the first scrim click closes only the menu, and a second scrim click closes the sheet. The switcher step behaves the same way.mainmainmain)Maintainer carry
A maintainer commit on this branch (credited to the author) finishes the change:
hasLightDismiss={false}.Layer/useBackdropPress.tsstays as it was, so this pull request changes no runtime Layer module.hasLightDismiss={false}(it usespurpose="info"), and the switcher still dismisses only from the active sheet's dialog. The affected suites pass (61 files, 2,287 tests), and type checking passes. A second carry commit sends the whole press in six more Core tests (DateTimeInput, MultiSelector, PowerSearch) and puts the Actions menu in the story's sheets for the browser checks.A later maintainer merge brings in
mainwith no conflict, and a last maintainer commit changes only comments and records: the switcher's scrim comment gives one reason a sentence, andfamily:overlay-dismissal's FR11 verification row and the Chromium spec's header name both sheets, which the menu-inside cases cover. No executable code changes in that commit.A review suggestion that can wait for a later change is tracked in #13511.
Owner and land path