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

DIalog: modal prop is not always respected #4334

Closed
ThomDevine opened this issue May 2, 2023 · 2 comments
Closed

DIalog: modal prop is not always respected #4334

ThomDevine opened this issue May 2, 2023 · 2 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.

Comments

@ThomDevine
Copy link

Describe the bug

When Dialog's prop "modal" is set to "true", it does not always prevent the underlying DOM node from being scrolled.

I have not been able to figure out why in our app it's sometimes respected and other times is not. The code sandbox here is forked from the https://primereact.org/dialog/ example. It sets modal={true} and adds enough content to both the dialog and the document body to make them scroll.

Reproducer

https://codesandbox.io/s/primereact-demo-forked-s6r5y5?file=/src/App.js

PrimeReact version

9.3.1

React version

17.x

Language

ES6

Build / Runtime

Vite

Browser(s)

Chrome 112

Steps to reproduce the behavior

  1. Click on the "Show" button.
  2. Scroll down in either the dialog (past its end) or on the body itself.

Expected behavior

Scrolling on the body should be prevented for as long as the dialog is open.

@ThomDevine ThomDevine added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 2, 2023
@melloware
Copy link
Member

melloware commented May 2, 2023

2 things.

  1. The property you want is "blockScroll". That blocks the background from scrolling while the nodal is open

  2. I just fixed a bug related the defaults of the block scrolling see Dialog: body scroll is not restored when closing maximized Dialog #4313

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 2, 2023
@melloware melloware added this to the 9.4.0 milestone May 2, 2023
@melloware melloware self-assigned this May 2, 2023
@melloware
Copy link
Member

I updated your reproducer with blockScroll and its working fine: https://codesandbox.io/s/primereact-demo-forked-1714ch

I will re-open if you think there is another issue

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@melloware melloware removed this from the 9.4.0 milestone May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants