question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot adjust the min-width of MatSelect select panel

See original GitHub issue

What is the expected behavior?

When trying to adjust min-width property of the select panel, it should be overriden properly for customization purposes: .mat-select-panel { min-width: 100% !important; }.

What is the current behavior?

After applying changed min-width property, the select panel has “jumping” width when showing/hiding.

What are the steps to reproduce?

Min-width override causes jumping: https://stackblitz.com/edit/angular-mat-select-issue Temporary fix that I made: https://stackblitz.com/edit/angular-mat-select-issue-tempfix

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

"@angular/material": "7.0.1", "@angular/animations": "7.0.1" "@angular/cdk": "7.0.1"

Is there anything else we should know?

Details I found that the most possible reason for such “jumping” effect is the “transformPanel” animation (see @angular/material/esm2015/select.js, lines 45…65) It uses breakpoints with different minWidth values. After commenting them out I was able to remove the “jumping” effect.

Workaround

  • My temporary workaround uses some dirty CSS hacks by hiding the overflow on the .cdk-overlay-pane, so it affects clipping of scrollbar, and that’s not good at all.
  • Another possible hack might be overriding the animation, but it’s also not clean at all.
  • It will be really great to see a working solution, when we talk about customizable width of select panel.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:20
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
prajaktashahcommented, Jul 11, 2019

still not working with following specifications: “@angular/animations”: “^7.2.13”, “@angular/cdk”: “^7.2.2”, “@angular/core”: “^7.2.13”, “@angular/material”: “^7.2.2”,

1reaction
mmalerbacommented, Jul 20, 2020

Closing since it seems to be fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular material - Mat-select panel min-width - Stack Overflow
I'm trying to customize mat-select with multiple checkboxes. for some reason the panel get wrong min-width as below:.
Read more >
Angular Matselect Style Min Width Opacity Hack - StackBlitz
https://stackoverflow.com/questions/53092399/mat-select-panel-min-width/53104251?noredirect=1#comment94709768_53104251.
Read more >
Access Angular Material's MatSelect Options Panel Container
In this article we're going to explore how you can programmatically access the Angular Material Select panel, without doing strange global ...
Read more >
mat select width - Code Examples & Solutions For This ...
new-figures-machine.component.css'], //add this to enable change style encapsulation: ViewEncapsulation.None, }) .mat-select-panel { min-width: calc(100% + ...
Read more >
Overlay | Angular Material
The custom class to be set on the backdrop element. ... The min width of the overlay panel. ... CSS selector which to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found