Skip to content

[drawer] Scroll instead of swiping when a drag starts on an SVG - #5844

Merged
atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/base-ui-issue-5843-a8c116
Oct 5, 2026
Merged

atomiks merged 2 commits into
mui:masterfrom
atomiks:claude/base-ui-issue-5843-a8c116

Conversation

@atomiks

@atomiks atomiks commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5843

The drawer's scroll checks walked up from the touched element only if it was an HTMLElement. When a drag started on an SVG node (a chart, or an icon inside a button), the walk never started. The drawer then decided there was no scrollable content and swiped instead of scrolling. Mouse drags had the same problem through hasScrollableAncestor: dragging on text inside scrollable content did not swipe, but dragging on an SVG there did.

This PR makes the walk step over SVG and MathML elements and only check HTML elements for scrollability. The touch and pointer paths now share one ancestor walk, so they can't drift apart again. Toast swipes use the same walk and get the same fix.

@atomiks atomiks added type: bug It doesn't behave as expected. component: drawer Changes related to the drawer component. labels Oct 2, 2026
@pkg-pr-new

pkg-pr-new Bot commented Oct 2, 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@5844
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5844
    

commit: 6b89db0

@code-infra-dashboard

code-infra-dashboard Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-39B(-0.01%) ▼-15B(-0.01%)

Details of bundle changes

Performance

Total duration: 519.61 ms +30.07 ms(+6.1%) | Renders: 76 (+0) | Paint: 955.65 ms +50.86 ms(+5.6%)

Test Duration Renders
Select mount (200 instances) 69.75 ms 🔺+13.29 ms(+23.5%) 3 (+0)
Mixed surface mount (app-like density) 46.25 ms 🔺+9.20 ms(+24.8%) 5 (+0)
Combobox type — 500 items, all stay mounted (type "Row ") 17.97 ms 🔺+5.00 ms(+38.6%) 11 (+0)
Combobox open — 500 items 15.53 ms 🔺+4.21 ms(+37.1%) 4 (+0)
Combobox type — 500 items, narrows to ~11 (type "Row 25") 21.93 ms 🔺+3.72 ms(+20.4%) 15 (+0)

…and 1 more (+9 within noise) — details

Metric alarms

Test Metric Change
Select mount (200 instances) bench:paint 🔺 +20.43 ms
Combobox type — 500 items, all stay mounted (type "Row ") bench:paint#combobox-open 🔺 +9.00 ms
Combobox type — 500 items, all stay mounted (type "Row ") bench:paint 🔺 +9.00 ms
Combobox open — 500 items bench:paint#combobox-open 🔺 +8.87 ms
Combobox open — 500 items bench:paint 🔺 +8.87 ms

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

@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 6b89db0
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6ac30d960dcab6000895d991
😎 Deploy Preview https://deploy-preview-5844--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@atomiks
atomiks marked this pull request as ready for review October 2, 2026 02:16
@atomiks
atomiks force-pushed the claude/base-ui-issue-5843-a8c116 branch from 7980bc0 to dd405a2 Compare October 2, 2026 02:26
@atomiks
atomiks force-pushed the claude/base-ui-issue-5843-a8c116 branch from 524558e to 6b89db0 Compare October 5, 2026 02:38
@atomiks
atomiks merged commit f7cb21c into mui:master Oct 5, 2026
24 checks passed
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: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[drawer] A drag that starts on an SVG inside scrollable content swipes the drawer instead of scrolling

1 participant