emilkowalski / vaul

An unstyled drawer component for React.
https://vaul.emilkowal.ski
MIT License
5.98k stars 199 forks source link

Fixed body when modal is open should be optional #347

Closed amendezm closed 1 week ago

amendezm commented 4 months ago

image

Description:

Currently, when the modal is opened in Vault, the body position is set to fixed, which may not always be desirable for all use cases. It would be beneficial to have an option to prevent this behavior by passing a prop or setting a configuration option.

Expected Behavior:

I expect that there should be an option available to prevent the body position from becoming fixed when the modal is opened. This could be achieved by adding a prop such as preventFixedBody={true} that can be passed to the modal component.

Additional Context:

This feature would provide more flexibility for users who want to customize the behavior of the modal without affecting the body position. It would be especially useful in scenarios where maintaining the body scroll is necessary while the modal is open.

Proposed Solution:

Add a prop to the modal component that allows users to specify whether the body position should be fixed when the modal is opened.

For example:

 <Drawer.Root
        preventFixedBody
pukmajster commented 4 months ago

doesn't the noBodyStyles prop solve this?

emilkowalski commented 1 week ago

Fixed body has been removed in #409.