Skip to content

Scrim -> SideSheet + Dialog - Scrollbar does not reappear when closing both at the same time #3724

Open
@Bjornar97

Description

Describe the bug

When opening a sidesheet and a dialog, then closing both at the same time (in the same function), the main scollbar does not reappear, and it is no longer possible to scroll the page.

There was a similar bug in an earlier version (0.41.4), which is in this issue: #3617
But in the previous case, it also happened when closing one at a time. This time, its just when closing both at the same time.

Seems like this bug has been here since since the previous one, we just didnt notice until now.

I found a workaround, adding a "sleep" in between closing the dialog and sidesheet like this, so react events are run in between them:

setShowDialog(false);

// This ensures that the dialog closes before the side sheet closes, which avoids the scrollbar disappearing
await new Promise((resolve) => setTimeout(resolve, 0));

setShowSidesheet(false);

Steps to reproduce the bug

  1. Have this structure Scrim -> Sidesheet -> Dialog, all of them wrapped in a createPortal to document.body.
  2. Open sidesheet, then open dialog
  3. Close both dialog and sidesheet in one function.

Expected behavior

The scrollbar comes back, and the page is scrollable again.

Specifications

  • Version: 0.43.0
  • Browser: Edge 132
  • OS: Windows 11

Additional context

Minimal reproduction sandbox: CodeSandbox

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions