Skip to content

[popover] Fix swiping or scrolling on nested popup dismissing popover on touch - #3011

Merged
atomiks merged 7 commits into
mui:masterfrom
atomiks:fix/pointer-move-children
Oct 27, 2025
Merged

atomiks merged 7 commits into
mui:masterfrom
atomiks:fix/pointer-move-children

Conversation

@atomiks

@atomiks atomiks commented Oct 18, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #3008

This ensures pressing on nested children (in the React tree) doesn't dismiss on pointermove (swiping/scrolling) by using the capture event trick, which is already done for the other event handlers

Also refactored from pointer to touch events because (at least on non-iOS/on Chrome DevTools), pointermove stops firing once scroll starts, while touchmove always fires which ensures the popover always dismisses while scrolling away

Note: #2978 refactors away the timeout for the handleCaptureInside logic - I will rebase one of the PRs depending on which is merged first

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

pkg-pr-new Bot commented Oct 18, 2025 •

Copy link
Copy Markdown

vite-css-base-ui-example

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

commit: 6a3846b

@netlify

netlify Bot commented Oct 18, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 6a3846b
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/68fea2f419126100083c94de
😎 Deploy Preview https://deploy-preview-3011--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.

@mui-bot

mui-bot commented Oct 18, 2025 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui-components/react 🔺+405B(+0.11%) 🔺+75B(+0.06%)

Details of bundle changes

@atomiks
atomiks force-pushed the fix/pointer-move-children branch from 1e49be7 to f45a406 Compare October 18, 2025 11:57
@atomiks
atomiks marked this pull request as ready for review October 18, 2025 12:29
@atomiks
atomiks force-pushed the fix/pointer-move-children branch from 23548eb to a7806f2 Compare October 18, 2025 12:37
@atomiks
atomiks force-pushed the fix/pointer-move-children branch from a7806f2 to 039fb7e Compare October 18, 2025 12:39
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 21, 2025
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 22, 2025

@mnajdova mnajdova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Csb with the fix: https://codesandbox.io/p/devbox/brave-butterfly-rm8zjs?workspaceId=ws_HE9JRzFW36Y2kpBoSwdvZ5

Can you elaborate why we are removing the way to customize the capture of the keyboard event using escape? What's the correlation to the bug?

/**
* Determines whether to use capture phase event listeners.
*/
capture?: boolean | { escapeKey?: boolean; outsidePress?: boolean };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't we still need this? Why was it removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it's an option from Floating UI config, but we don't use it anywhere in our components, so it can be removed.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 26, 2025
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 26, 2025

@mnajdova mnajdova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👌

@atomiks
atomiks merged commit 3d8ed2e into mui:master Oct 27, 2025
@atomiks
atomiks deleted the fix/pointer-move-children branch October 27, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: popover Changes related to the popover component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[popover] Modal inside Popover is closed unexpectedly on mobile when swiping

3 participants