Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a64291b

Browse files
SplaktarThomasBurleson
authored andcommitted
fix(input, css): fix regression that broke input placeholders on Firefox
Change to only hide automatic placeholders on webkit. This fixes Firefox so that placeholders are visible again. Fixes #2162. Fixes #2480. Fixes #2045. Closes #1409. Closes #3582.
1 parent 621bdf7 commit a64291b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/components/input/input.scss

+12-3
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,20 @@ md-input-container {
111111
opacity: 0;
112112
}
113113

114-
&:not( .md-input-has-value ) input:not( :focus ) {
115-
color: transparent;
114+
&:not( .md-input-has-value ) input:not( :focus ),
115+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-ampm-field,
116+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-day-field,
117+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-hour-field,
118+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-millisecond-field,
119+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-minute-field,
120+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-month-field,
121+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-second-field,
122+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-week-field,
123+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-year-field,
124+
&:not( .md-input-has-value ) input:not( :focus )::-webkit-datetime-edit-text {
125+
color: transparent;
116126
}
117127

118-
119128
/*
120129
* The .md-input class is added to the input/textarea
121130
*/

src/components/input/input.spec.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ describe('md-input-container directive', function() {
8888
expect(el).not.toHaveClass('md-input-has-value');
8989
}));
9090

91-
it('should match label to given input id', inject(function($rootScope) {
91+
it('should match label to given input id', inject(function() {
9292
var el = setup('id="foo"');
9393
expect(el.find('label').attr('for')).toBe('foo');
9494
expect(el.find('input').attr('id')).toBe('foo');
9595
}));
9696

97-
it('should match label to automatic input id', inject(function($rootScope) {
97+
it('should match label to automatic input id', inject(function() {
9898
var el = setup();
9999
expect(el.find('input').attr('id')).toBeTruthy();
100100
expect(el.find('label').attr('for')).toBe(el.find('input').attr('id'));
@@ -164,7 +164,7 @@ describe('md-input-container directive', function() {
164164
expect(label.textContent).toEqual('some placeholder');
165165
}));
166166

167-
it('should put ignore placeholder when a label element is present', inject(function($rootScope, $compile) {
167+
it('should ignore placeholder when a label element is present', inject(function($rootScope, $compile) {
168168
var el = $compile('<md-input-container><label>Hello</label><input ng-model="foo" placeholder="some placeholder"></md-input-container>')($rootScope);
169169
var placeholder = el[0].querySelector('.md-placeholder');
170170
var label = el.find('label')[0];
@@ -174,8 +174,7 @@ describe('md-input-container directive', function() {
174174
expect(label.textContent).toEqual('Hello');
175175
}));
176176

177-
it('should expect an aria-label on the input when no label is present', inject(function($rootScope, $compile) {
178-
177+
it('should put an aria-label on the input when no label is present', inject(function($rootScope, $compile) {
179178
var el = $compile('<form name="form">' +
180179
' <md-input-container md-no-float>' +
181180
' <input placeholder="baz" md-maxlength="max" ng-model="foo" name="foo">' +

0 commit comments

Comments
 (0)