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.
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.
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
toAlertDialog
'sPortal
sub-component, even when the dialog is closed.Removing
forceMount
fromPortal
successfully fixed the behaviour, therefore I'm convinced there's an issue betweenforceMount
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