Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

input: date/time type labels and "placeholders" conflict #1409

Closed
ilanbiala opened this issue Feb 5, 2015 · 6 comments
Closed

input: date/time type labels and "placeholders" conflict #1409

ilanbiala opened this issue Feb 5, 2015 · 6 comments
Assignees
Labels
resolution: fixed severity: regression This issue is related to a regression type: bug
Milestone

Comments

@ilanbiala
Copy link
Contributor

screen shot 2015-02-05 at 6 58 13 pm
The input "placeholders" are created by the browser (Chrome in this particular picture), not me.

@gustavohenke
Copy link

@marcysutton
Copy link
Contributor

That does seem like a decent solution, since we'd want to keep the native keyboards for mobile but change the styling. From @gustavohenke's awesome suggestion on the forum:

md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-ampm-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-day-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-hour-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-millisecond-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-minute-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-month-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-second-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-week-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-year-field,
md-input-container:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-text {
  color: transparent;
}

My question (without stopping what I'm doing to go try it out): do the selectors have to be that verbose? Should the color be transparent only when it's not focused or has a value?

@gustavohenke
Copy link

Hmmm... well, I don't know what I was thinking when writing that huge selector. Looks pretty obvious now! Probably, some question in StackOverflow bit me.

This one will work:

md-input-container:not( .md-input-has-value ) input:not( :focus ) {
     color: transparent;
}

Demo: http://plnkr.co/edit/JAWVTQQKzgXtLH9N12tQ?p=preview

@marcysutton
Copy link
Contributor

I guess that does work! I thought we'd want to target the -webkit pseudo selectors.

@Splaktar
Copy link
Member

Splaktar commented Jul 4, 2015

@gustavohenke This selector doesn't work on Firefox. #2162

The -webkit pseudo selectors do appear to work properly and avoid breaking Firefox.

@ThomasBurleson ThomasBurleson reopened this Jul 4, 2015
@ThomasBurleson ThomasBurleson added this to the 0.10.1 milestone Jul 4, 2015
@ThomasBurleson ThomasBurleson self-assigned this Jul 4, 2015
@Splaktar
Copy link
Member

Splaktar commented Jul 4, 2015

#3582 seems to fix this and resolve the Firefox regression.

@Splaktar Splaktar assigned Splaktar and unassigned ThomasBurleson Jul 7, 2015
@Splaktar Splaktar changed the title Input type date/time labels and "placeholders" conflict input: date/time type labels and "placeholders" conflict Dec 9, 2018
@Splaktar Splaktar added resolution: fixed type: bug severity: regression This issue is related to a regression labels Dec 9, 2018
@angular angular locked as resolved and limited conversation to collaborators Dec 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: fixed severity: regression This issue is related to a regression type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants