Skip to content

[drawer] Restore SwipeArea component - #4102

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/restore-drawer-swipe-area
Mar 9, 2026
Merged

atomiks merged 1 commit into
mui:masterfrom
atomiks:codex/restore-drawer-swipe-area

Conversation

@atomiks

@atomiks atomiks commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

@atomiks atomiks added type: new feature Expand the scope of the product to solve a new problem. component: drawer Changes related to the drawer component. labels Feb 16, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 16, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@4102
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4102
    

commit: 27201e9

@mui-bot

mui-bot commented Feb 16, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+4.53KB(+0.98%) 🔺+1.2KB(+0.81%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Feb 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 933677f
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69ae6b2e39fd1800082031ea
😎 Deploy Preview https://deploy-preview-4102--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks marked this pull request as ready for review February 16, 2026 10:31
@greptile-apps

greptile-apps Bot commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository.

@michaldudak

Copy link
Copy Markdown
Member

Sometimes it's impossible to close the drawer by clicking on the backdrop:

Screen.Recording.2026-02-16.at.14.33.03.mov

I'm also still experiencing the original issue where the drawer opens halfway when dragged quickly (both with mouse and touchpad). In these cases it's also impossible to close it by clicking outside.

Screen.Recording.2026-02-16.at.14.35.19.mov

@flaviendelangle

Copy link
Copy Markdown
Member

Claude Code mostly complained about tests:

Issues Found in Tests

  1. Test "re-enables outside press dismissal after opening by swipe" relies on an unrealistic setup

The test renders <Drawer.Root><Drawer.SwipeArea /></Drawer.Root> with no Portal/Popup/Viewport. After swipe-opening, it clicks document.body and expects the drawer to close via outside-press dismissal.

This works because floating-ui's useDismiss considers any click as "outside" when there's no popup element (the popup ref is null). In a real app, you'd always render a Popup when the drawer is open. The test is
technically testing floating-ui's edge behavior rather than the SwipeArea's enableDismissAfterRelease logic in a realistic scenario.

A more robust test would render the full drawer structure (Portal > Viewport > Popup) and click outside the popup, verifying the drawer closes after the deferred re-enable.

  1. No test coverage for touch input path

All tests use pointerType: 'mouse'. The component has distinct code paths for touch vs non-touch input (DrawerSwipeArea.tsx:402-429):

  • Non-touch: handled by swipePointerProps (pointer events)
  • Touch: handled by swipeTouchProps (touch events), pointer events are skipped early

The touch path is entirely untested.

  1. No test for the data-swiping attribute

The component maps swiping state to data-swiping (line 43-44), but no test verifies this attribute appears during an active swipe gesture.

  1. The size-based threshold test could be fragile

In "uses a size-based swipe threshold by default", the waitBeforeRelease callback uses a hardcoded wait(120) to ensure the popup has mounted and laid out. While this is Chromium-only (skipping JSDOM), the fixed
timing could be fragile under CI load. Consider using a layout-readiness check instead of a fixed delay.

@atomiks
atomiks force-pushed the codex/restore-drawer-swipe-area branch from 4675ed3 to fef7b91 Compare March 6, 2026 08:04
@atomiks

atomiks commented Mar 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex Review

Overview

This patch restores Drawer.SwipeArea as a public drawer part, brings its docs and demo back, and adds focused coverage for swipe-to-open behavior and public state hooks. The latest follow-up also keeps the demo from trapping page scroll when the cursor is over the example panel.

Findings (None)

No blocking issues found in this patch.

Confidence: 5/5

High confidence from a full-branch diff review and targeted reruns on the rebased branch, including the touch path, the size-threshold path, and the controlled swipe-dismiss cleanup path.

Notes

  • Re-reviewed after rebasing onto the latest master.
  • Verified with pnpm test:jsdom DrawerSwipeArea --no-watch, pnpm test:chromium DrawerSwipeArea --no-watch, and pnpm test:chromium DrawerRoot --no-watch --testNamePattern "does not dismiss a controlled drawer via swipe when open is always true".

@atomiks
atomiks force-pushed the codex/restore-drawer-swipe-area branch 2 times, most recently from fa28add to 6ea5cec Compare March 6, 2026 09:14
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 7, 2026
@atomiks
atomiks force-pushed the codex/restore-drawer-swipe-area branch from 6ea5cec to 933677f Compare March 9, 2026 06:39
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 9, 2026
@atomiks
atomiks merged commit 43f5b9d into mui:master Mar 9, 2026
6 checks passed
@atomiks
atomiks deleted the codex/restore-drawer-swipe-area branch March 9, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: drawer Changes related to the drawer component. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants