Skip to content

bug(COMPONENT): TITLE #27124

Open
Open
@lcy0221

Description

@lcy0221

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Expected: The page does not have a scroll bar. The HTML tag is not added with cdk-global-scrollblock.
Actually: When zoom the browser to 90%,drag the browser so that the width of the body is 1398.890px and there is no horizontal or vertical scroll bar.as a result, body.scrollWidth is 1399px, viewport.width is 1398px. cdk-global-scrollblock is added to the html tag.

private _canBeEnabled(): boolean {
// Since the scroll strategies can't be singletons, we have to use a global CSS class
// (cdk-global-scrollblock) to make sure that we don't try to disable global
// scrolling multiple times.
const html = this._document.documentElement!;

if (html.classList.contains('cdk-global-scrollblock') || this._isEnabled) {
  return false;
}

const body = this._document.body;
const viewport = this._viewportRuler.getViewportSize();
return body.scrollHeight > viewport.height || body.scrollWidth > viewport.width;

}

Reproduction

Steps to reproduce:

  1. zoom the browser to 90%,
    2.drag the browser so that the width of the body is 1398.890px

Expected Behavior

The page does not have a scroll bar. The HTML tag is not added with cdk-global-scrollblock.

Actual Behavior

The page does not have a scroll bar. The HTML tag is added with cdk-global-scrollblock.

Environment

  • Angular: 14.2.0
  • CDK/Material: 14.2.0
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): window 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: cdk/scrolling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions