-
Notifications
You must be signed in to change notification settings - Fork 6.8k
mat-select-trigger is invisible if value is undefined or null #7758
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
Comments
This is the intended behavior. Options with a value of |
@crisbeto while this is currently intended behavior, is there any wisdom in always rendering the trigger value if |
@crisbeto But you should be able to put your own display value for when nothing is selected like |
@mmalerba the problem is knowing when to show it. We probably don't want to show it and float the label on a blank select that the user hasn't interacted with, because it makes it stand out next to other blank fields and we can't know whether a value of
|
I see. I have an issue filed for input to separate the concept of label vs placeholder (#6194) to make it match the latest mocks. Maybe a similar sort of thing could work for the select, when the label floats we reveal the |
Why don't we show the trigger whenever the label floats? |
I believe that there is similar issue when the select is multiple and no value is selected: the value is then an empty array, evaluating to a falsy value just as null or undefined.... Please let me know if this deserves another issue or not. I wanted to remain on the less-noisy option by default. |
@crisbeto assigning to you since its related to the label / placeholder split |
ETA on this please? |
@crisbeto, regarding when to show it: I would strongly argue that if the value for 'trigger' is not empty, it should always be displayed. The developer has full control over the value provided to the trigger, and with a simple 'Placeholder will not display unless the triggerValue is empty' in the docs, it's clear enough what needs to be done. If that is not an option, then it should be one, via a flag. For a use case, I present a multi-select where 'No Selection' is allowed. I would like to display 'All', 'Partial ({{count}})' or 'None'. I cannot display None, because the selection is empty thus the (empty) placeholder is displayed instead. |
Is there any workaround which is not including extra option for this one? |
I also have a list of 'All', 'Open', 'Vacant', where the model is a nullable boolean. Choosing 'All' will set the model to null or undefined. If resetting the displayed option to the placeholder value is the 'expected behavior', what then are we supposed to do in situations like I just described? |
now we have mat-label for this
@crisbeto I think you can close this issue |
I have used placeholder & label both. I am still facing the issue. There is a no way for user to know that list is empty. It's just looks like click is not working on select. I don't understand why this issue is closed. |
@akvaliya |
That's not my requirements. It float on click. User should be able to know that list is empty. |
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. |
Bug, feature request, or proposal:
md-select-trigger
is invisible if value isundefined
ornull
when
MD_PLACEHOLDER_GLOBAL_OPTIONS
set to{ float: 'always' }
(use to show field name)i cant show 'All' or 'Please Select ... ' on the
md-select
What is the expected behavior?
need a way to show hint text / empty option alternative text
What is the current behavior?
mat-select-trigger
is invisible if value isundefined
ornull
What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-vyqfqf
What is the use-case or motivation for changing an existing behavior?
use select as a list filter, or form control with a hint text
The text was updated successfully, but these errors were encountered: