Skip to content

CDK: ConnectedPositionStrategy not open for extension #9206

Open
@ronaldmansveld

Description

@ronaldmansveld

Bug, feature request, or proposal:

Currently the ConnectedPositionStrategy in the CDK marks its properties and methods as private, preventing subclassing in an efficient matter. If these properties and methods were marked as protected instead, developers can more easily extend these classes to add/modify behaviour.

What is the expected behavior?

The class marks its internals as protected, so it can be subclassed and extended

What is the current behavior?

The class marks its internals as private, preventing effective subclassing and extension

What are the steps to reproduce?

Not applicable

What is the use-case or motivation for changing an existing behavior?

Currently the ConnectedPositionStrategy looks at the viewport to determine what (fallback) position to use when displaying the overlay. I have a use-case where I want this to be affected by a parent-element's boundaries instead of the viewport.
The easiest way to achieve this, is to subclass the existing ConnectedPositionStrategy, redefining the apply method to look at an injected element instead of looking at the viewport.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All

Is there anything else we should know?

I initially raised #9194 , but that one was considered too broad.
I'm willing to create a PR to go with this issue, but want to make sure I don't miss any reasons why this class is not open for extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: cdk/overlayfeatureThis issue represents a new feature or feature request rather than a bug or bug fixneeds: discussionFurther discussion with the team is needed before proceeding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions