Skip to content

Commit 6853f4d

Browse files
committed
fix 1px jitter and baseline alignment
1 parent db8fe76 commit 6853f4d

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

src/demo-app/baseline/baseline-demo.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
<input mdInput placeholder="Input" value="Text Input">
1515
</md-form-field>
1616
| Text 5 |
17-
<md-select placeholder="Select">
18-
<md-option value="option">Option</md-option>
19-
</md-select>
17+
<md-form-field>
18+
<md-select placeholder="Select">
19+
<md-option value="option">Option</md-option>
20+
<md-option value="long">This option is really really really long</md-option>
21+
</md-select>
22+
</md-form-field>
2023
| Text 6 |
2124
<md-form-field>
2225
<textarea mdInput placeholder="Input" mdTextareaAutosize>Textarea&#10;Line 2</textarea>
@@ -42,9 +45,12 @@ <h1>
4245
<input mdInput placeholder="Input" value="Text Input">
4346
</md-form-field>
4447
| Text 5 |
45-
<md-select placeholder="Select">
46-
<md-option value="option">Option</md-option>
47-
</md-select>
48+
<md-form-field>
49+
<md-select placeholder="Select">
50+
<md-option value="option">Option</md-option>
51+
<md-option value="long">This option is really really really long</md-option>
52+
</md-select>
53+
</md-form-field>
4854
| Text 6 |
4955
<md-form-field>
5056
<textarea mdInput placeholder="Input" mdTextareaAutosize>Textarea&#10;Line 2</textarea>

src/lib/select/select.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<div #trigger #origin="cdkOverlayOrigin" cdk-overlay-origin class="mat-select-trigger"
22
aria-hidden="true" (click)="toggle()">
3-
<span class="mat-select-value">
3+
<div class="mat-select-value">
44
<div #measureFontSize class="mat-select-measure-font-size" aria-hidden="true"></div>
5+
<ng-container *ngIf="empty">&nbsp;</ng-container>
56
<span class="mat-select-value-text" *ngIf="!empty" [ngSwitch]="!!customTrigger">
67
<span *ngSwitchDefault>{{ triggerValue }}</span>
78
<ng-content select="md-select-trigger, mat-select-trigger" *ngSwitchCase="true"></ng-content>
89
</span>
9-
</span>
10+
</div>
1011

11-
<span class="mat-select-arrow"></span>
12+
<div class="mat-select-arrow-wrapper"><div class="mat-select-arrow"></div></div>
1213
</div>
1314

1415
<ng-template

src/lib/select/select.scss

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
@import '../core/style/vendor-prefixes';
55
@import '../core/a11y/a11y';
66

7-
$mat-select-trigger-min-width: 112px !default;
87
$mat-select-arrow-size: 5px !default;
98
$mat-select-arrow-margin: 4px !default;
109
$mat-select-panel-max-height: 256px !default;
@@ -16,15 +15,12 @@ $mat-select-item-height: 3em !default;
1615

1716
// Inside of a form field we want it to expand to take the available space.
1817
.mat-form-field & {
19-
display: block;
2018
width: 100%;
2119
}
2220
}
2321

2422
.mat-select-trigger {
25-
display: flex;
26-
align-items: center;
27-
min-width: $mat-select-trigger-min-width;
23+
display: inline-table;
2824
cursor: pointer;
2925
position: relative;
3026
box-sizing: border-box;
@@ -36,16 +32,22 @@ $mat-select-item-height: 3em !default;
3632
}
3733

3834
.mat-select-value {
39-
display: flex;
40-
flex: auto;
41-
align-items: center;
42-
min-width: 0;
35+
display: table-cell;
36+
max-width: 0;
37+
width: 100%;
38+
overflow: hidden;
39+
text-overflow: ellipsis;
4340
}
4441

4542
.mat-select-value-text {
4643
@include mat-truncate-line();
4744
}
4845

46+
.mat-select-arrow-wrapper {
47+
display: table-cell;
48+
vertical-align: middle;
49+
}
50+
4951
.mat-select-arrow {
5052
width: 0;
5153
height: 0;

0 commit comments

Comments
 (0)