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

<paper-input-decorator label=“birthday”> #1251

Closed
gertcuykens opened this issue Mar 3, 2015 · 6 comments
Closed

<paper-input-decorator label=“birthday”> #1251

gertcuykens opened this issue Mar 3, 2015 · 6 comments

Comments

@gertcuykens
Copy link

Is it possible to show the label birthday like the other decorators when the input field is empty?

    <paper-input-decorator label="birthday">
           <core-localstorage name="birthday" value="{{birthday}}"></core-localstorage>
           <input name="birthday" value="{{birthday}}" is="core-input" type="date" required>
    </paper-input-decorator>

In safari you see a empty field
In chrome a pre defined dd/mm/yyyy
But there is no indication of the label birthday

http://stackoverflow.com/questions/28840931/polymer-paper-input-decorator-label-birthday

@ssorallen
Copy link
Contributor

type="date" has a browser-defined placeholder that represents the format of the date. You should use a real <label>:

<paper-input-decorator>
  <core-localstorage name="birthday" value="{{birthday}}"></core-localstorage>
  <label>
    Birthday
    <input name="birthday" value="{{birthday}}" is="core-input" type="date" required>
  </label>
</paper-input-decorator>

@gertcuykens
Copy link
Author

Not really consistent with type="text" but good enough thanks :)

@ssorallen
Copy link
Contributor

To be clear, the part that seems inconsistent to you is the way Chrome implements type="date". This is unrelated to Polymer. This JSFiddle shows the difference: http://jsfiddle.net/ssorallen/0w73nxhn/

Worth noting however is that neither Firefox nor Safari implements a date picker for type="date" yet. They likely behave the way you are expecting. Try opening that JSFiddle in each browser.

@gertcuykens
Copy link
Author

True I much rather see chrome displaying the label first and only show the empty place holder 'dd/mm/yyyy' only when the field gets selected. If you know a chrome developer tell him or her to look at your example :P

@ssorallen
Copy link
Contributor

That's not how the placeholder attribute is designed to work though. Also according to the spec, "The placeholder attribute should not be used as an alternative to a label."

You should use real <label> elements when the value is truly a label.

@gertcuykens
Copy link
Author

Ok fair enough

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