Skip to content

Commit

Permalink
no pointer events for label (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi authored Aug 2, 2016
1 parent 0222d1d commit a508229
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paper-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
:host {
display: block;
}

:host([focused]) {
outline: none;
}
Expand All @@ -97,6 +97,10 @@
input:-ms-input-placeholder {
color: var(--paper-input-container-color, --secondary-text-color);
}

label {
pointer-events: none;
}
</style>

<paper-input-container no-label-float="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
Expand Down
4 changes: 4 additions & 0 deletions paper-textarea.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
:host([hidden]) {
display: none !important;
}

label {
pointer-events: none;
}
</style>

<paper-input-container no-label-float$="[[noLabelFloat]]" always-float-label="[[_computeAlwaysFloatLabel(alwaysFloatLabel,placeholder)]]" auto-validate$="[[autoValidate]]" disabled$="[[disabled]]" invalid="[[invalid]]">
Expand Down
6 changes: 6 additions & 0 deletions test/paper-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@
assert.isTrue(inputContent.classList.contains('label-is-floating'), 'label is floating');
});

test('label does not receive pointer events', function() {
var input = fixture('always-float-label');
var label = Polymer.dom(input.root).querySelector('label');
assert.equal(getComputedStyle(label).pointerEvents, 'none');
});

test('error message is displayed', function() {
var input = fixture('error');
forceXIfStamp(input);
Expand Down
6 changes: 6 additions & 0 deletions test/paper-textarea.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
var inputContent = Polymer.dom(container.root).querySelector('.input-content');
assert.isTrue(inputContent.classList.contains('label-is-floating'), 'label is floating');
});

test('label does not receive pointer events', function() {
var input = fixture('always-float-label');
var label = Polymer.dom(input.root).querySelector('label');
assert.equal(getComputedStyle(label).pointerEvents, 'none');
});
});

suite('focus/blur events', function() {
Expand Down

0 comments on commit a508229

Please sign in to comment.