Skip to content
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

Issues with label and md-input type="Number" #2092

Open
JerichoKain opened this issue Jul 5, 2019 · 4 comments
Open

Issues with label and md-input type="Number" #2092

JerichoKain opened this issue Jul 5, 2019 · 4 comments

Comments

@JerichoKain
Copy link

Steps to reproduce

  1. Start with a md-field with a label and <md-input v-model="num" type="Number">.
  2. Make the field an invalid number (e.g. 11.11.11). The md-input's v-model num will be cleared and treated as if there is no value while the inner input element maintains a value
  3. Remove focus from the field. Because the v-model has been cleared, the input treats it as empty and shows the label as a placeholder covering the invalid input.

Further inspection shows that the value in the $el.value is maintained, only the v-model is not.

Which browser?

Chrome: 75
Firefox: 66
Vue: ^2.6.10
Vue Material: ^1.0.0-beta11

What is expected?

The v-model value should not be cleared and the label should not cover the input value.

What is actually happening?

The v-model is cleared and the label acts as if there are no values in the the md-field.

Reproduction Link

https://codesandbox.io/s/vue-material-quick-start-l55e4

@Topinaqui
Copy link
Contributor

Hi, I'm working on this issue. As this will be my first contribution to the project, any guidance will be welcome :)

@JerichoKain
Copy link
Author

I also duplicated the issue here in development mode so you have use the vue dev tools to inspect: https://jerichokain.github.io/vue-material-input/
from this repo: https://github.com/JerichoKain/vue-material-input

I began to look into it a little more over the weekend, as far as I could tell the issue really is that the model is being cleared, which will trigger the label to cover the value in the input.

In src\components\MdField\MdField.vue I think the stringValue is what is triggering the label to move, which is coming from the MdFieldMixin.js... and here is where I got lost. I think the mixin is trying to use value and localValue to bind with the md-input and the md-field, and maybe something is getting lost there?

@Topinaqui
Copy link
Contributor

Topinaqui commented Jul 10, 2019 via email

@Topinaqui
Copy link
Contributor

Hi, I created a pull request to solve the problem: #2108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants