Skip to content

bug(cdk/overlay): Setting maxWidth on overlay messes up top and bottom position #27783

Open
@Jacobra93

Description

@Jacobra93

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

Setting maxWidth on the overlay messes up the positioning. If you instead set only width, it works fine. But maxWidth messes it up. It seems to work fine with some positions, but breaks top and bottom positioning.

Reproduction

StackBlitz link: https://stackblitz.com/edit/k6wprl?file=src%2Fexample%2Fcdk-overlay-basic-example.ts
Steps to reproduce:

  1. Click "Display overlay" button

Expected Behavior

Overlay should be properly positioned.

Actual Behavior

Overlay doesn't have correct positioning, it is off to the side instead of being above the button that triggered it.

Environment

  • Angular: 16.2.3
  • CDK/Material: 16.2.3
  • Browser(s): Chrome

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/overlay

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions