components icon indicating copy to clipboard operation
components copied to clipboard

md-input input text is not grayed-out when disabled

Open danny-swimmer opened this issue 10 years ago • 10 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When the md-input is disabled, the input text should be grayed-out. The expected behavior is documented in Google design here: https://material.google.com/components/text-fields.html#text-fields-labels

What is the current behavior?

Input text is not grayed-out.

What are the steps to reproduce?

Please refer to this plunk: http://plnkr.co/edit/fzZY5ASZ2vQlhOci8z9P Note that the input text is the same intensity, whether or not it's disabled. The underline, however, does correctly change to a dotted line when disabled.

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

User can't tell whether the input is disabled or not.

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

Angular 2.1.0 Material 2.0.0-alpha.10 Linux Chrome

Is there anything else we should know?

No.

danny-swimmer avatar Nov 16 '16 14:11 danny-swimmer

Will likely be obsolete by <md-input> refactor.

jelbourn avatar Nov 18 '16 00:11 jelbourn

very similar issue using reactive forms.

using this form code the md-input is not disabled. Adding the disabled keyword, angular forms generates a warning.

form = new FormGroup({ first: new FormControl({value: 'Nancy', disabled: true}, Validators.required), last: new FormControl('Drew', Validators.required) });

bgauvey avatar Nov 24 '16 01:11 bgauvey

The same is happening with md-checkbox. When I disable a checkbox like this:

<md-checkbox formControlName="myControl" disabled=true></md-checkbox>

I receive this warning:

It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true when you set up this control in your component class, the disabled attribute will actually be set in the DOM for you. We recommend using this approach to avoid 'changed after checked' errors.
       
      Example: 
      form = new FormGroup({
        first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
        last: new FormControl('Drew', Validators.required)
      });

However, initializing a FormControl with { value: 'anyValue', disabled: true} doesn't seem to do anything. The input ignores the disabled property and remains enabled.

pmulac avatar Dec 01 '16 21:12 pmulac

fixed by #2513

mmalerba avatar Jan 04 '17 19:01 mmalerba

I am using 2.0.0-beta.8 and I still have this problem

pantonis avatar Jul 31 '17 12:07 pantonis

@pantonis It appears to be working correctly, did you install a theme? https://material.angular.io/guide/theming

mmalerba avatar Jul 31 '17 16:07 mmalerba

No nothing. I have to call enable(), disable() to make it work

pantonis avatar Jul 31 '17 18:07 pantonis

I think the disabled styles live in the theme css, so that's probably why it doesn't look right.

mmalerba avatar Jul 31 '17 18:07 mmalerba

?? :)

pantonis avatar Jul 31 '17 18:07 pantonis

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.