-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix(select): set select value to trigger height and center text #3021
Conversation
Great catch @andrewseguin! I was struggling with reproducing this one. |
src/lib/select/select.scss
Outdated
top: 6px; | ||
height: $mat-select-trigger-height; | ||
|
||
display: flex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check if long values get ellipsis with this? I had a fix a while ago that removed it, because it didn't seem to work with flexbox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked, there's an issue with ellipsis. I believe this can be solved by giving the text itself a span of its own that will have the overflow hidden property. I'll add that to the PR shortly
So I added a bit more changes to make it a little more explicit and future-proof. Children of an element with a border end up with different sizes for I took border-bottom out and just made a new span to handle the look of a border. That way the option element is for sure 30px on all browsers. I added an inner span to take care of our truncation as well, thanks for the heads up on that. |
Instead of creating something completely new, couldn't the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits
src/lib/select/select.scss
Outdated
position: absolute; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a mixin for these 4 lines in core called mat-fill
. Use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost, I want to have it sink to the bottom of the container so it's missing the top: 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, I can't read. Ignore me!
src/lib/select/select.scss
Outdated
|
||
[aria-disabled='true'] & { | ||
@include mat-control-disabled-underline(); | ||
border-bottom: transparent; | ||
background-position: 0 bottom; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you moved this line. Still necessary to keep up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed that one, will remove
I tried getting a mixin to work with both select and input underlines but since they have different structures its hard to get a good common ground. Select needs to position bottom but this messes up on input. If we can find a way to structure them similarly then I think its worth finding a commons style, but perhaps in another PR. As for using ::after, I felt that it was a little more complex for users to figure out what they need to override to change the stylings (e.g. underline size, color). By having a separate span, it makes it very easy for them to understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
d88ef8c
to
1858609
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Issue was that the text div was actually being calculated as 29px, not 30px, because the trigger had a border bottom of 1px. This made the following code incorrect since the option value height was actually 29px:
This change forces the option value to be 30px and centers the text using flex. Tested on Linux Chrome, Linux FF, Windows IE11 & Edge, Mac Chrome, and Mac FF.
Closes #2977