Skip to content

Commit

Permalink
Merge pull request #60 from vaadin/fix/IE-change-indeterminate
Browse files Browse the repository at this point in the history
Set indeterminate to false when clicked the first time.
  • Loading branch information
web-padawan authored Jan 5, 2018
2 parents ff0ebac + 04ff6a4 commit 0da9c67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/vaadin-checkbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,18 @@
}

_handleClick(e) {
if (!this.disabled && !this.indeterminate) {
if (e.composedPath()[0] !== this._nativeCheckbox) {
e.preventDefault();
this._toggleChecked();
if (!this.disabled) {
if (!this.indeterminate) {
if (e.composedPath()[0] !== this._nativeCheckbox) {
e.preventDefault();
this._toggleChecked();
}
} else {
/*
* Required for IE 11 and Edge.
* See issue here: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7344418/
*/
this.indeterminate = false;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions test/vaadin-checkbox_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@
expect(vaadinCheckbox.getAttribute('aria-checked')).to.be.eql('mixed');
});

it('should set indeterminate to false when clicked the first time', () => {
vaadinCheckbox.indeterminate = true;

vaadinCheckbox.click();

expect(vaadinCheckbox.indeterminate).to.be.false;
});

it('native checkbox should have the `presentation` role', () => {
expect(vaadinCheckbox.getAttribute('role')).to.be.eql('checkbox');
});
Expand Down

0 comments on commit 0da9c67

Please sign in to comment.