Skip to content

Commit 964596f

Browse files
authored
fix: don't prevent space keyup while interacting in grid (#2744)
1 parent 46df501 commit 964596f

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎packages/grid/src/vaadin-grid-keyboard-navigation-mixin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ export const KeyboardNavigationMixin = (superClass) =>
628628

629629
/** @private */
630630
_onKeyUp(e) {
631-
if (!/^( |SpaceBar)$/.test(e.key)) {
631+
if (!/^( |SpaceBar)$/.test(e.key) || this.interacting) {
632632
return;
633633
}
634634

‎packages/grid/test/keyboard-navigation.test.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
} from './helpers.js';
2828
import '../vaadin-grid.js';
2929
import '../vaadin-grid-column-group.js';
30+
import '../vaadin-grid-selection-column.js';
3031

3132
let grid, focusable, scroller, header, footer, body;
3233

@@ -1366,6 +1367,19 @@ describe('keyboard navigation', () => {
13661367
expect(spy.called).to.be.true;
13671368
expect(grid.activeItem).to.be.null;
13681369
});
1370+
1371+
it('should allow toggling a checkbox with space keypress', async () => {
1372+
// Add a selection column
1373+
grid.appendChild(document.createElement('vaadin-grid-selection-column'));
1374+
flushGrid(grid);
1375+
1376+
// Get a reference to a checkbox, focus it and hit space
1377+
const vaadinCheckbox = getCellContent(getRowCell(0, 3)).children[0];
1378+
vaadinCheckbox.focus();
1379+
await sendKeys({ press: 'Space' });
1380+
1381+
expect(vaadinCheckbox.checked).to.be.true;
1382+
});
13691383
});
13701384
});
13711385

0 commit comments

Comments
 (0)