Skip to content

Commit

Permalink
fix(tile): add check to make sure element exists (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonjoseph authored and marijohannessen committed May 18, 2018
1 parent 27b1226 commit fcc1ba5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/tile/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ class Tile extends mixin(createComponent, initComponentBySearch) {
});
this.element.addEventListener('keydown', evt => {
const input = this.element.querySelector(this.options.selectorTileInput);
if (evt.which === 13 || evt.which === 32) {
if (!isExpandable) {
this.element.classList.toggle(tileClass);
input.checked = !input.checked;
if (input) {
if (evt.which === 13 || evt.which === 32) {
if (!isExpandable) {
this.element.classList.toggle(tileClass);
input.checked = !input.checked;
}
}
}
});
Expand Down

0 comments on commit fcc1ba5

Please sign in to comment.