feat(cdk/menu): allow user to configure scroll strategy on menu triggers #28965
Labels
area: cdk/menu
feature
This issue represents a new feature or feature request rather than a bug or bug fix
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Feature Description
I'd like to change the scroll strategy of a cdk menu to lock the screen instead of repositioning it.
This is possible in Material by providing a custom MAT_MENU_SCROLL_STRATEGY injection token.
The customizable scrollStrategy is then provided through DI in the constructor:
components/src/material/menu/menu-trigger.ts
Line 269 in e2bfb91
However, in the cdk version of the menu the scroll strategy is hard coded and does not allow for any customization:
components/src/cdk/menu/menu-trigger.ts
Line 252 in e2bfb91
Use Case
I am building a component library on top of the Angular CDK. I'd love to allow users to choose if they'd like to lock scrolling upon opening of a dropdown menu like the default of Angular Material's Menu: https://material.angular.io/components/menu/overview
Or keep the repositioning strategy that is currently the only option for the CDK.
I am specifically trying to implement this request from one of my users: goetzrobin/spartan#277
I think Angular Material supporting a custom strategy and the CDK not supporting a strategy is confusing to a lot of end users and I'd love for both to be customizable!
The text was updated successfully, but these errors were encountered: