components icon indicating copy to clipboard operation
components copied to clipboard

Mat Select Spacing increases on blank value select

Open rfuhrer opened this issue 8 years ago • 1 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Spacing should be consistent no matter what is selected

What is the current behavior?

If you select an option that has a display of blank ('') the control grows 3 pixels

What are the steps to reproduce?

https://stackblitz.com/edit/mat-select-blank-spacing?file=app/select-overview-example.ts Select the blank option in one control and notice the underlines no longer line up as one control has increased in size

What is the use-case or motivation for changing an existing behavior?

I'm working with a legacy backend system that doesn't support null values for some IDs. So sending an ID of 0 is what is used to mean "not selected". To accommodate this I added a <mat-option [value]="0"></mat-option to a select control. This is when I noticed the bug.

You can work around it by changing the display to "None" or something similar, but it is odd that you can't just leave a blank value here.

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

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.8
Node: 10.3.0
OS: win32 x64
Angular: 6.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      6.3.0
@angular/cli                      6.0.8
@angular/flex-layout              6.0.0-beta.16
@angular/material                 6.3.0
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

rfuhrer avatar Jun 28 '18 18:06 rfuhrer

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.