You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FormField] Fields hidden when using non-stock theme #8960
User should be able to see the form fields (mat-form-field) displayed on the page.
What is the current behavior?
When using one of the stock angular material themes, such as '.../prebuilt-themes/deeppurple-amber.css', the fields display without issue. However, using a custom theme, the mat-form-fields are hidden by default. They are rendered on the page, but are invisible until clicked upon. When clicked, the animation occurs and moves the label up to the top (stock behavior), and the field clicked becomes visible. Also, tabbing through the fields, once one field has focus, reveals the fields one by one.
What are the steps to reproduce?
Best way to get familiar with the issue is to look here: #3196
It's the same issue, previously closed, but I was not missing the DOCTYPE in my index.html, nor am I missing the BrowserAnimationsModule.
What is the use-case or motivation for changing an existing behavior?
No idea. Need your help to resolve that. :-)
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Browsers
Chrome 62+
Edge 40.15+
Firefox 56.0 (32-bit)
Angular
@angular/core 5.0.5
@angular/material 5.0.0
OS
Windows 10
TypeScript
2.4.2
Is there anything else we should know?
See the description below.
If I use one of the stock angular material themes such as: @import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
... my inputs appear as follows...
... as soon as I try to implement a custom theme, here is what happens:
... as you can see, its basically the same the others who are experiencing the same issue... the matInputs are there but invisible.
Clicking into them does begin the animation and properly display them (one at a time).
changed the title [-]<mat-form-field>s hidden when using non-stock angular material theme[/-][+][FormField] Fields hidden when using non-stock theme[/+]on Dec 12, 2017
@mmalerba - hey there... just wanted to say thank you for looking into this issue.
I was curious if there had been any progress during the course of the last few days... or even just an idea as to the nature of the issue... how likely you feel it would be to being solved, etc. No pressure regarding time, just curious for a status update / thoughts on how this issue looks.
Thanks in advance for all of the assistance on this issue.
Adding the code change that you suggested prevents the code from compiling.
Are you inferring here that $dark-theme should be an altogether separate theme that should be defined and then applied here?
$background: map-get($dark-theme, background);
At this point, $dark-theme is not defined.
Note: @mmalerba - just so we're clear on what my ultimate goal is here, since I didn't clearly state it above. My only goal is to have a simple, standard color-scheme applied to my form element label and control text. Black, dark-gray, etc... red-coloring for errors... just what might be considered a simple/standard color scheme for the web. If there is a built-in theme that achieves this (that is visible on a white background), then let me know - happy to just use that and move away from trying to define a custom theme.
If you want the colors to show up right for a dark theme you need to make the background element a dark color. If you actually wanted a light theme use mat-light-theme instead.
Activity
crisbeto commentedon Dec 12, 2017
Can you post what your theme looks like?
rcanacci commentedon Dec 12, 2017
[-]<mat-form-field>s hidden when using non-stock angular material theme[/-][+][FormField] Fields hidden when using non-stock theme[/+]rcanacci commentedon Dec 15, 2017
@mmalerba - hey there... just wanted to say thank you for looking into this issue.
I was curious if there had been any progress during the course of the last few days... or even just an idea as to the nature of the issue... how likely you feel it would be to being solved, etc. No pressure regarding time, just curious for a status update / thoughts on how this issue looks.
Thanks in advance for all of the assistance on this issue.
mmalerba commentedon Dec 15, 2017
It looks like you're using a dark theme, but in your screenshot the background is white. Dark themes expect to be used on a dark background.
You could try adding this to your CSS:
rcanacci commentedon Dec 18, 2017
@mmalerba - Thank you for responding.
Adding the code change that you suggested prevents the code from compiling.
Are you inferring here that $dark-theme should be an altogether separate theme that should be defined and then applied here?
$background: map-get($dark-theme, background);At this point, $dark-theme is not defined.
Note:
@mmalerba - just so we're clear on what my ultimate goal is here, since I didn't clearly state it above. My only goal is to have a simple, standard color-scheme applied to my form element label and control text. Black, dark-gray, etc... red-coloring for errors... just what might be considered a simple/standard color scheme for the web. If there is a built-in theme that achieves this (that is visible on a white background), then let me know - happy to just use that and move away from trying to define a custom theme.
Thanks.
mmalerba commentedon Dec 18, 2017
Oh sorry I didn't notice your alternate theme only applied to the button anyways. But your custom theme is also defined as a dark theme
If you want the colors to show up right for a dark theme you need to make the background element a dark color. If you actually wanted a light theme use
mat-light-themeinstead.dannythebestguy commentedon Dec 22, 2017
So does this mean that in a dark theme, the forms cannot be displayed on a white background ?
Normally Forms are on white background irrespective of dark/light theme of a website.
In any way can we change the component's light/dark feature and keep the main theme as it is ?
mmalerba commentedon Dec 22, 2017
You can use a dark theme for your app and a light theme for your forms if you like. Explanation of how to use multiple themes is here: https://material.angular.io/guide/theming#multiple-themes
Closing this issue since it's not a bug.
angular-automatic-lock-bot commentedon Sep 8, 2019
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.