-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Remove highlight md-input-container for mdInput[readonly] on focus #5749
Comments
Unfortunately the spec does not say anything about read-only inputs. But on the other hand, disabled/read-only is HTML specific. I think we should treat read-only as disabled. The user does not know the difference between the two. The difference for devs are that one is sent through POST while the other is not (in traditional HTML/POST). |
* Doesn't highlight the `md-input-container` if the underlying readonly input is focused. This is consistent with the native behavior both on PC and Mac. * Adds a unit test to ensure that the `mat-focused` class s being added. Fixes angular#5749.
* Doesn't highlight the `md-input-container` if the underlying readonly input is focused. This is consistent with the native behavior both on PC and Mac. * Adds a unit test to ensure that the `mat-focused` class s being added. Fixes #5749.
* Doesn't highlight the `md-input-container` if the underlying readonly input is focused. This is consistent with the native behavior both on PC and Mac. * Adds a unit test to ensure that the `mat-focused` class s being added. Fixes #5749.
@grizzm0 I wouldn't treat readonly inputs as disabled ones. A good case is the date-picker component. I would like to have a readonly input (for the date) but still have an enabled component where the user could click on it and display the date-picker. Although I can do this, now the highlight is gone for the input. |
@susox if you use a native date input ( Try it out: http://plnkr.co/edit/QUT9rKOneg7GEsoOYwnI?p=preview The native If you really need to add focus on readonly, you might be able to create a directive or achieving that with CSS. |
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:
Proposal: if we set a
mdInput
as readonly, it should not highlight the placeholder and border.It's currently adding a highlight within the
md-input-container.mat-focused
.What is the expected behavior?
I believe the border and placeholder should keep the style on focus.
What is the current behavior?
What are the steps to reproduce?
Focus on the readonly input
Providing a Plunker (or similar) is the best way to get the team to see your issue.
http://plnkr.co/edit/Y7hAk6fuZkFTCEfI52IU?p=preview
What is the use-case or motivation for changing an existing behavior?
User Experience. A better way to show the user the input is readonly.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
I would like to send a PR, but I'm not sure the best approach to solve that.
@Input() readonly
tomd-input-container
(which could be duplicating code)mat-focused
if is readonlymat-focused--readonly
os similar_onFocus()
if the input is readonly. (so we wouldn't hightlight the placeholder os something like that) and the user can override it.The text was updated successfully, but these errors were encountered: