Angular material mat-select drop-down size and scroll problem on item select

Viewed 1630

Goal:

To have a mat-select with multiple select but with bigger drop-down size.

Knows solutions:

Add panelClass to mat-select and customize it's max-height. It seems working fine in some cases.

Problem

When clicking on items in the drop-down, scroll jumps unexpectedly.

Material trying to center the clicked item to visible view and as we changed the size of drop-down, it's losing sizes and scrolling in the wrong way.

This problem appears only when you have multiple select.

Scroll jump problem

Possible solution

  • Wait for Material when drop-down size change will be officially implemented. For now, it is constant. const SELECT_PANEL_MAX_HEIGHT: 256;
  • Don't change the size of drop-down) In this case, the goal will not be reached as we need a bigger drop-down to see more options without scroll.
  • Please suggest another option.

Problem illustration:

https://stackblitz.com/edit/angular-material-select-scroll-jumps-on-bigger-size

0 Answers
Related