Hi @2020media
The select field is a bit different to the rest in that it doesn’t actually have a label – instead it inserts your label text as the first option in the field. It’s done this way because at the time it was built, the Material Components library (by Google) didn’t have a good alternative.
It will be fixed in an upcoming release, but if you just want to fix the colour, and know how to add some JavaScript and Custom CSS to your theme, you can do the following.
1. Add this JavaScript to your theme
jQuery(document).on('ready', function(){
jQuery('.cf7md-select select').on('change', function(e) {
if (jQuery(this).val() !== jQuery(this).find('option:first-of-type').attr('value')) {
jQuery(this).addClass('is-selected').removeClass('is-label')
} else {
jQuery(this).removeClass('is-selected').addClass('is-label')
}
})
})
2. Add this CSS to Appearance > Customizer > Material Design Forms > Custom CSS
#cf7md-form .mdc-select.is-label {
color: rgba(0, 0, 0, 0.38);
}
#cf7md-form .mdc-select.is-selected {
color: rgba(0, 0, 0, 0.87);
}
Thanks,
Angus
Thank you, I see what you mean – in fact it does behave differently when a value has been selected – there’s no label above it showing what the values relate to.
I think I’ll use a radio button for my purpose here, and look out for a future update.
Thank you.
@gusruss89
is there any prospect of an update to this bug?
Not having the label animated above the select when choosing an option is not that nice UX wise..
Hi @jessman5
This will be fixed in v2, which is an upgrade to the new material styles for inputs and select fields. The new versions do have a floating label, while the old ones did not.
See the demo here – https://material-components.github.io/material-components-web-catalog/#/component/select
v2 is still in development (it’s a big job to make sure the update doesn’t break people’s existing forms) and does not yet have an ETA.
Sorry about that, but you can be assured that I am working on improving this.
Thanks,
Angus
Okay thanks, looks promising.
I’ll do a workaround till then.