Skip to content
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

Mat-Select with appearance="standard": Arrow too high #11925

Closed
seritools opened this issue Jun 25, 2018 · 8 comments · Fixed by #12045
Closed

Mat-Select with appearance="standard": Arrow too high #11925

seritools opened this issue Jun 25, 2018 · 8 comments · Fixed by #12045
Assignees

Comments

@seritools
Copy link
Contributor

Bug, feature request, or proposal:

When using appearance="standard" on a mat-form-field, the arrow of a mat-select moves up quite a lot.

What is the expected behavior?

The arrow should be at the same location as with legacy appearance.

What is the current behavior?

A translateY(-50%) is applied to the arrow-wrapper, moving it too high.

What are the steps to reproduce?

Stackblitz, based on an example from the Angular Material docs: https://stackblitz.com/edit/angular-o9gzca?file=app/select-no-ripple-example.html

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

Tested with 6.2.1, updated to 6.3.0, still occurring. Angular 6.0.6, Typescript 2.7.2.
Tested in Chrome 69 dev, IE11, Vivaldi, etc.

@johnbuffington
Copy link

johnbuffington commented Jul 3, 2018

hi @mmalerba, it looks like the "standard" appearance is the only appearance type in which the arrow doesn't look correct, even though it is "correctly" centered. one way this could be fixed is to check if the placeholder input property or mat-label directive is being used. if either one is being used, the style should be translateY(-50%) and no style if no placeholder or mat-label. what do you think?

here's the blame for reference:
https://github.com/angular/material2/blame/0675e0513d511e18fc72805a8817046cc1630468/src/lib/select/select.scss#L49

@mmalerba
Copy link
Contributor

mmalerba commented Jul 3, 2018

@johnbuffington yeah that seems reasonable, do you want to send a PR for it?

@seritools
Copy link
Contributor Author

seritools commented Jul 3, 2018

Hmm, even with a label, as long as no value is selected it looks weird, because the label transitions into the value area. The other non-legacy appearances have a visible height because of the border/background, and their value area is moved way up as well.
Comparing these, the position of the value string seems more like the problem. IMHO either the arrow always needs to be lower for the standard appearance, or the value display needs to move up to the same height as the fill/outline appearances.

EDIT: For an easy comparison: https://stackblitz.com/edit/angular-o9gzca-6nuihz?file=app/select-no-ripple-example.html

Would it be possible to shift the arrow up to the current position whenever the select has a selected value?

@mmalerba
Copy link
Contributor

mmalerba commented Jul 3, 2018

@seritools That is not something I've seen in the spec, but the spec also seems to have completely removed this variant... so I'm ok with it if it doesn't look too jarring. If one of you wants to send a PR with this change I'll take a look and see how it feels.

@seritools
Copy link
Contributor Author

I think I misread the way issues are referenced in the commits :S
But yeah, that would be my attempt at solving this, have a look. :)

jelbourn pushed a commit that referenced this issue Aug 23, 2018
This commit aims to fix the arrow positioning of mat-selects
with appearance="standard". Since the label moves down whenever
the selected value is empty, the arrow looks out of place.
I added an animation that matches the speed of the label
animation:
Going from filled to empty transitions the arrow down so that it
sits level with the label.
Going from empty to filled snaps the arrow back up, matching the
label's behavior.
To test/compare the different appearances I added another card
to the demo-app with all of them.
@simeyla
Copy link

simeyla commented Nov 26, 2018

There are still no examples under mat-select for a control with appearance='standard'.
So when you add appearance='standard' to a form field you get something that just looks wrong.

image

To be honest I'm getting used to it, but at first the way it looks really is bizarre, compared to the other example styles. At the very least the documentation needs updating, to include examples for appearance=standard and explain that the arrow is higher in the new format.

@ghost
Copy link

ghost commented Dec 5, 2018

@simeyla I noticed this as well a few months ago, and even reported a bug for it (#13907).
The animation added by #12045 might help a little, but there are some case where the arrow definitely doesn't sit right on its current position. For example, paginators' size selectors, since their height is very short compared to other select elements. You can see a StackBlitz example of this case, on the ticket I reported.

@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 10, 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

Successfully merging a pull request may close this issue.

4 participants