Fix checkbox change event not firing on enter press (#12703) (#12735)

* Fix checkbox change event not firing

* Add comment
This commit is contained in:
Charles Gagnon
2020-10-05 12:53:59 -07:00
committed by GitHub
parent 1f65216889
commit 5f59fa021c

View File

@@ -48,6 +48,9 @@ export class Checkbox extends Widget {
this.onkeydown(this._el, e => {
if (e.equals(KeyCode.Enter)) {
this.checked = !this.checked;
// Manually fire the event since we stop the event propagation which means
// the onchange event won't fire.
this._onChange.fire(this.checked);
e.stopPropagation();
}
});