Skip to content

[Backdrops] Fix text selection & right-clicks #1702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mj12albert
Copy link
Member

@mj12albert mj12albert commented Apr 11, 2025

Fixes #1705

  • Adding WebkitUserSelect: 'none' to the inlined styles prevents text selection on touch

  • Only main-button clicks on dialog backdrop should close it

  • I have followed (at least) the PR section of the contributing guide.

@mj12albert mj12albert added the component: dialog This is the name of the generic UI component, not the React module! label Apr 11, 2025
@mj12albert mj12albert added component: select This is the name of the generic UI component, not the React module! component: menu This is the name of the generic UI component, not the React module! component: popover This is the name of the generic UI component, not the React module! labels Apr 11, 2025
@mj12albert mj12albert changed the title [Backdrops} Prevent text selection on backdrops [Backdrops] Prevent text selection on backdrops Apr 11, 2025
Copy link

netlify bot commented Apr 11, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit c87d01f
🔍 Latest deploy log https://app.netlify.com/sites/base-ui/deploys/67fdbbc512e13e000813afc9
😎 Deploy Preview https://deploy-preview-1702--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 site configuration.

@mj12albert mj12albert changed the title [Backdrops] Prevent text selection on backdrops [Backdrops] Fix text selection & right-clicks Apr 11, 2025
@mj12albert
Copy link
Member Author

@atomiks I've only updated the dismiss behavior for Dialog so it doesn't close on right click (matches Radix)

Will leave the rest alone in this PR given the larger outside press issue

Copy link
Contributor

@atomiks atomiks left a comment

Choose a reason for hiding this comment

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

Do you need regular userSelect for Android?

Also wonder if pointerEvents: undefined (instead of conditional rendering for openReason === 'hover' could be a problem

@mj12albert
Copy link
Member Author

Also wonder if pointerEvents: undefined (instead of conditional rendering for openReason === 'hover' could be a problem

I tested Popover with a mouse and a phone and it seems ok, but openReason === 'hover' ? 'none' : 'auto' could work too, what do you think? @atomiks

@atomiks
Copy link
Contributor

atomiks commented Apr 16, 2025

undefined should be ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dialog This is the name of the generic UI component, not the React module! component: menu This is the name of the generic UI component, not the React module! component: popover This is the name of the generic UI component, not the React module! component: select This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Backdrops] Interaction bugs
2 participants