Skip to content

(md-select) with placeholder changes size when selected #3073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benb7760 opened this issue Feb 12, 2017 · 5 comments
Closed

(md-select) with placeholder changes size when selected #3073

benb7760 opened this issue Feb 12, 2017 · 5 comments

Comments

@benb7760
Copy link

benb7760 commented Feb 12, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

An md-select with a selection should be the same size as with no selection

What is the current behavior?

This is true for an md-select with no placeholder, but when I provide a placeholder, the control sizes differently

As a side note - can anybody comment on why the second controls placeholder overlaps with the control above, when selected? Is this a bug which should be filed separately?

What are the steps to reproduce?

Select a value in both of the lists, and you'll see an offset

http://plnkr.co/edit/KdHQWMFXj2hEFWWFRJyq?p=preview

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

Reproduced in Chrome and Safari latest (not tried other browsers)

@benb7760 benb7760 changed the title bug - md-select with placeholder changes size when selected (md-select) with placeholder changes size when selected Feb 12, 2017
@dahaupt
Copy link

dahaupt commented Feb 12, 2017

@benb7760 To answer your second question: This issue is already known and will be fixed soon with #2309.

@dahaupt
Copy link

dahaupt commented Feb 12, 2017

This is because of this method in select.ts:

private _setValueWidth() {
    this._selectedValueWidth =  this._triggerWidth - 13;
  }

When removing this line it works fine, but I'm not sure about the side effects of that.

EDIT:
The comment above the method says "Must set the width of the selected option's value [...]", but the width is added to <span class="mat-select-placeholder"> instead of <span class="mat-select-value"> which would fit to the comment. I'm not sure if this is needed anymore, because without setting it explicitly it works fine at least in Chrome.

@dahaupt
Copy link

dahaupt commented Feb 17, 2017

To fix this temporary you can use:

span.mat-select-placeholder.mat-floating-placeholder {
  width: auto !important;
}

@jelbourn
Copy link
Member

jelbourn commented Jun 6, 2017

Tracking via #2124

@jelbourn jelbourn closed this as completed Jun 6, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants