Skip to content

Drawer: Scroll lock tied incorrectly to dismissable #8116

@daveeels

Description

@daveeels

Describe the bug

Description

The Drawer component is incorrectly handling body scroll lock when the dismissable prop changes.

When the drawer is opened and dismissable = true, the body scroll is blocked as expected.

If the dismissable prop is later updated to false while the drawer is still open, the body scroll is unblocked, even though the drawer remains visible.

This behavior is inconsistent because body scroll should remain blocked whenever the drawer is open, regardless of the dismissable value.

Pull Request Link

#8115

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-bzlp5ypq?file=src%2FApp.vue

Environment

Vue: v3.5.21
PrimeVue: v4.3.9
Browser: Chrome
OS: Windows 11

Vue version

3.5.21

PrimeVue version

4.3.9

Node version

No response

Browser(s)

Chrome 140.0.7339.128 (Official Build) (arm64)

Steps to reproduce the behavior

Steps to Reproduce

  1. Render a Drawer component with dismissable = true.
  2. Open the Drawer.
  3. Body scroll is blocked (correct).
  4. Change dismissable to false while the Drawer is still open.
  5. Body scroll becomes unblocked, even though the Drawer is still visible.

Expected behavior

Body scroll should remain blocked as long as the Drawer is open.

The dismissable prop should only control whether the Drawer can be dismissed by the user, not whether body scroll is locked.

Metadata

Metadata

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not working

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions