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

[AlertDialog] forceMount causes document body scroll-locked even when AlertDialog is closed #3100

Open
seedy opened this issue Sep 4, 2024 · 1 comment

Comments

@seedy
Copy link

seedy commented Sep 4, 2024

Bug report

Current Behavior

I want to animate AlertDialog entering and closing, therefore I was planning on using forceMount prop.

Document body is scroll-locked when applying forceMount to AlertDialog's Portal sub-component, even when the dialog is closed.

Screenshot 2024-09-04 at 12 50 08

Screenshot 2024-09-04 at 12 46 27
Screenshot 2024-09-04 at 12 46 13

Removing forceMount from Portal successfully fixed the behaviour, therefore I'm convinced there's an issue between forceMount and scroll-locking behaviours.

Expected behavior

Document body should not be scroll-locked when the AlertDialog is in closed state.

Reproducible example

Codesandbox repro

Suggested solution

Conditionally apply the scroll-locked behavior on open, instead of on mount of AlertDialog.

Additional context

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-alert-dialog 1.1.1
React n/a
Browser n/a
Assistive tech n/a
Node n/a
npm/yarn n/a
Operating System n/a
@seedy seedy changed the title [AlertDka: [AlertDialog] forceMount causes document body scroll-locked even when AlertDialog is closed Sep 4, 2024
@seedy
Copy link
Author

seedy commented Sep 4, 2024

Turns out I can use CSS-only animations for my use-case.
Hence, that bug is non-blocking to me ! 👌

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

No branches or pull requests

1 participant