Skip to content

[dialog] Incorrect scroll-lock style calculation #2122

Open
@KingSora

Description

@KingSora

Bug report

Currently when opening a modal in Chrome on Android the bottom part of the screen is being cut-off due to an incorrect calculation of the height property. This is only happening if the top navigation / URL bar of the browser is hidden because the user scrolled down.

Current behavior

2025-06-17.10-27-13.mp4

In the video notice the bottom part of the page, its being cut-off when a dialog is open. The reason for that is the height: calc(-57px + 100dvh) style on the body element.

Expected behavior

The height and width of the body element should remain visually unchanged.

Reproducible example

https://base-ui.com/react/components/dialog

Base UI version

1.0.0-beta.0

Which browser are you using?

Chrome on Android

Which OS are you using?

Android

Additional context

Taking a look at the code this bug seems to be related to this line:

const scrollbarHeight = Math.max(0, win.innerHeight - html.clientHeight);
where the scrollbarHeight is being calculated as:

const scrollbarHeight = Math.max(0, win.innerHeight - html.clientHeight);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions