mui / mui/base-ui

[popover] Allow for a Popover that triggers on hover and can lock the scroll

Open
#3,848 2 comments 0 reactions 0 assignees View on GitHub
component: popover waiting for 👍
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

Hi! 👋

As far as I understand, it's not possible to have a Popover that triggers on hover and locks the scroll at the same time.
If we combine `Popover.Root[modal=true]` and `Popover.Trigger[openOnHover=true]`, what we get is that the trigger, when clicked, opens the popover and locks the scroll, but when hovered, it opens the popover but doesn't lock the scroll.

It looks like the exact cause is here:
https://github.com/mui/base-ui/blob/master/packages/react/src/popover/root/PopoverRoot.tsx#L83
`openReason !== REASONS.triggerHover`

## Motivation

I think it's a reasonable that we should be able to achieve this sort of behaviour with Popover.
It's also something that I would love for my use case.

Perhaps what would be best is that we could get a manual way of specifying if we would like to lock the scroll?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.