From b437d364ffe23bff711cddd597e1eae32008a693 Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Thu, 9 Feb 2017 13:02:29 -0800 Subject: [PATCH 1/4] fix(select): change styling to always center select value text --- src/lib/select/select.scss | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/select/select.scss b/src/lib/select/select.scss index b95435bb562e..304c9e42c2d5 100644 --- a/src/lib/select/select.scss +++ b/src/lib/select/select.scss @@ -78,13 +78,16 @@ $mat-select-trigger-font-size: 16px !default; // position. This has been fixed for Firefox 52, slated for early 2017. // Bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=874718 // - // In the meantime, we must adjust the left position to 0 to mimic where it - // would be if it were correctly taken out of the flex flow. It's also necessary - // to adjust the top value because absolutely positioned elements should not be - // affected by the flex container's "align-items" property either. To center the text, - // we must offset by 6px (6px top + 6px bottom + 18px text height = 30px total height). + // In the meantime, we must adjust the position to fit the top and left edge of the + // containing element with a height matching the trigger container. + // In doing so, we can use align-items: center to allow the text to + // correctly position itself in the middle of the container. + top: 0; left: 0; - top: 6px; + height: $mat-select-trigger-height; + + display: flex; + align-items: center; [dir='rtl'] & { left: auto; From 6d234d4e5549f4c548ce28b46a7b88f67c6db33e Mon Sep 17 00:00:00 2001 From: Andrew Seguin Date: Thu, 9 Feb 2017 14:00:39 -0800 Subject: [PATCH 2/4] move border to its own div; make value ellipsis --- src/lib/select/_select-theme.scss | 15 ++++++++++++--- src/lib/select/select.html | 5 ++++- src/lib/select/select.scss | 29 ++++++++++++++++++++++------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/lib/select/_select-theme.scss b/src/lib/select/_select-theme.scss index 5cc54c91fe63..a7d2c7415e32 100644 --- a/src/lib/select/_select-theme.scss +++ b/src/lib/select/_select-theme.scss @@ -9,16 +9,25 @@ .mat-select-trigger { color: mat-color($foreground, hint-text); - border-bottom: 1px solid mat-color($foreground, divider); .mat-select:focus:not(.mat-select-disabled) & { color: mat-color($primary); - border-bottom: 1px solid mat-color($primary); } .mat-select.ng-invalid.ng-touched:not(.mat-select-disabled) & { color: mat-color($warn); - border-bottom: 1px solid mat-color($warn); + } + } + + .mat-select-border { + background-color: mat-color($foreground, divider); + + .mat-select:focus:not(.mat-select-disabled) & { + background-color: mat-color($primary); + } + + .mat-select.ng-invalid.ng-touched:not(.mat-select-disabled) & { + background-color: mat-color($warn); } } diff --git a/src/lib/select/select.html b/src/lib/select/select.html index ca7ae280db9f..5fc618a68193 100644 --- a/src/lib/select/select.html +++ b/src/lib/select/select.html @@ -1,8 +1,11 @@
{{ placeholder }} - {{ selected?.viewValue }} + + {{ selected?.viewValue }} + +