Skip to content

@smui/dialog doesn't remove mdc-dialog-scroll-lock class from body if Dialog is unmounted while open #716

@NickantX

Description

@NickantX

Describe the bug
If a Dialog is unmounted before its close animation finishes, the mdc-dialog-scroll-lock class is not removed from the body and the page can no longer be scrolled (unless something else removes the class later, like opening another dialog)

To Reproduce
Steps to reproduce the behavior:

  1. Open a dialog
  2. Navigate away from the current page before the dialog finishes closing (e.x. navigating back to the previous page in a SvelteKit app in CSR mode)
  3. You can no longer scroll even though there is no open dialog

Expected behavior
The mdc-dialog-scroll-lock class should be removed, even if the Dialog was unmounted before the close animation finished. Scroll lock state should be tied to the presence of an open dialog, not necessarily controlled by animation timings.

Screenshots
https://github.com/user-attachments/assets/04ede050-3770-45f7-a56c-c392608c72e6

Desktop (please complete the following information):

  • OS: macOS 26.5
  • Browser: Ungoogled Chromium
  • Version: 148.0.7778.167 (Official Build, ungoogled-chromium) (arm64)

Additional context
Present since at least SMUI v7, still present in SMUI v9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions