-
Notifications
You must be signed in to change notification settings - Fork 159
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
paper-input type="number" floating doesn't work if you don't start with a number #632
Comments
Unfortunately this is a (duplicate of #377, which has more details) |
@notwaldorf can't we use the validity property of the input? |
I think we could listen to keypress, and look if badInput is true, and then float also! |
The actual validity of the input doesn't really have anything to do with it, since you don't get an event when the validity changes, so you need to listen to keypresses anyway. And that actually much more complicated than it sounds:
I'm leaning towards not fixing this since the solution sounds super messy and hard to maintain (and expensive, that even will fire every time you type), and the bug it fixes is actually fairly small, and you could technically write this workaround (the |
If I add this code: $0.onkeyup = (e) => console.log(e.path[0].validity.badInput) to the input in your paper input example: https://www.webcomponents.org/element/PolymerElements/paper-input/demo/demo/index.html (the one with the $ in front) it works as expected |
when you look here: paper-input/paper-input-container.html Line 591 in 43ad083
|
@notwaldorf if I work on a fix wich listens for keyup, will this be accepted? |
Is there also a bug in the element, cause the event listeners in the attached callback are added every time the control is attached to the dom. I use dockspawn (a docking framework), wich dettaches and attaches elements when you move your dock pages |
It works, if a add this to the ready:
and change:
to
i know this fix is not correct, but i don't know how the correct fix should look like? shoul iron-input wrap checkValidity? |
@notwaldorf have you read my comments? Do you still think itˋs not worth to be fixed? |
I have read, but can you send a PR so we can actually run tests and I can see the diff? It's starting to be hard to keep track of what the change exactly is, without the full diff :) |
I will do a pull req. But I'm not sure, if I only should fix it if child is a input, or also look if child is a iron-input. If it's a iron input, iron input has to expose some of the inputs api! |
I've created a fix, seehttps://github.com//pull/642 but googlebot says I've not signed the cla (but I have) |
fixed it, committed with wrong GH username ;-( |
Description
if you have paper-input type="number" and auto-validate pattern="[0-9]+" and you start typing with a '-' or an 'e' (allowed characters beside numbers), the floating does not work.
Expected outcome
The label is floating. Like this:
Actual outcome
Label not floating. Like this:
One minus works:
Two not:
I know that this entry makes no sense, but nevertheless it should float. Or should it only float if the entry is valid?
Live Demo
Steps to reproduce
paper-input
type="number"
auto-validate
pattern="[0-9]+"
start typing with e or -- or another allowed non number
Browsers Affected
Just checked Chrome yet!
The text was updated successfully, but these errors were encountered: