Skip to content

Commit

Permalink
Don’t access undefined _lastFocusedCell
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Mar 8, 2017
1 parent 6ba5cfa commit 98840f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/keyboard-navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,14 @@
expect(row.hasAttribute('focused')).to.eql.true;
expect(container.hasAttribute('focused')).to.eql.true;
});

it('should not throw on focus change', function() {
expect(function() {
clickItem(1);
getRowCells(getRows(grid.$.scroller.$.header)[0])[0].click();
clickItem(0);
}).to.not.throw(Error);
});
});

describe('interaction mode', function() {
Expand Down
2 changes: 1 addition & 1 deletion vaadin-grid-focusable-cell-container-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// for the virtual focus. This helps cell contents to detect if the cell
// has focus, which is useful for the accessibility reasons. Used by
// <vaadin-grid-sorter>.
if (this._lastFocusedCell || !focused) {
if (this._lastFocusedCell) {
this._lastFocusedCell._cellContent.dispatchEvent(new CustomEvent('cell-focusout'));
this._lastFocusedCell = undefined;
}
Expand Down

0 comments on commit 98840f3

Please sign in to comment.