Skip to content

bug(CDK Overlay): cdkConnectedOverlay ConnectedPosition not correctly calculated after scrolling on mobile browser  #23037

Open
@remcozigterman

Description

@remcozigterman

The ConnectedPositions for a cdkConnectedOverlay are not correctly calcullated when browsing and scrolling on a mobile browser. The mobile devices are hiding the address bar when you scroll down. This results in a change of the viewport sizes. If you open a cdkConnected overlay after scrolling it's position is at the wrong location.

Reproduction

https://stackblitz.com/edit/components-issue-mbxfr2

Steps to reproduce:

  1. Create a component with cdkConnectedOverlay
  2. Add it to your application
  3. Browse to your angular app on a mobile device a
  4. Open the overlay -> this should be correct positioned
  5. Scroll down (the browser hides the address bar)
  6. Overlay position is on wrong location

Expected Behavior

The connected overlay should be on the correct position after scrolling on a mobile device

Actual Behavior

The position of the overlay is calculated wrong and displayd at the wrong position.

The position of the overlay with the address bar (as expected)
Screenshot_20210622-150122_Chrome

The position of the overlay without the address bar, after scrolling (not as expected)
Screenshot_20210622-150129_Chrome

Environment

  • Angular: 12
  • CDK/Material: 12
  • Browser(s): Chrome Android, Safari IOS
  • Operating System: IOS, Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/overlayneeds investigationA member of the team needs to do further investigation to determine the root cause

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions