Skip to content
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

[Popover] Don't stick upon click with openOnHover prop #819

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

Conversation

atomiks
Copy link
Contributor

@atomiks atomiks commented Nov 15, 2024

The upgrade fixes bugs and adds this prop to turn off.

@atomiks atomiks added the component: popover The React component. label Nov 15, 2024
@mui-bot
Copy link

mui-bot commented Nov 15, 2024

Netlify deploy preview

https://deploy-preview-819--base-ui.netlify.app/

Generated by 🚫 dangerJS against 729124b

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 21, 2024
@michaldudak
Copy link
Member

Seems to work fine.

adds this prop to turn off.

There's no prop exposed to control this behavior?

@atomiks
Copy link
Contributor Author

atomiks commented Nov 22, 2024

There's no prop exposed to control this behavior?

Not currently but there could be. @vladmoroz

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 22, 2024
@vladmoroz
Copy link
Contributor

I wouldn't want to add a prop unless necessary—is there a typical design where it makes sense to keep it open on click?

@atomiks
Copy link
Contributor Author

atomiks commented Nov 22, 2024

I wouldn't want to add a prop unless necessary—is there a typical design where it makes sense to keep it open on click?

Back when I was developing tippy.js, the "stick" behavior was actually the requested default (a while ago, 2019), and it wasn't configurable. I didn't hear of complaints. It's also the default in Floating UI now (working better with the recent fixes).

Comment on lines +63 to +68
await user.hover(trigger);

// Closes instantly after opening due to `useClick` prop `stickIfOpen=false`
await act(async () => {
trigger.click();
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps this is why it's configured by default, but it depends on the delay you use. If you happen to click <50ms after it opens coincidentally, it's pretty unexpected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: popover The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants