Skip to content

Commit 0de4c7e

Browse files
PivotGrid - Ignore key auto-repeat in keyboard expand handler
1 parent 8b497e9 commit 0de4c7e

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,9 @@ class PivotGrid extends Widget {
887887
}
888888

889889
_handleCellKeyDown(e) {
890+
if (e.repeat) {
891+
return;
892+
}
890893
if (e.key === 'Enter' || e.key === ' ') {
891894
const args = this._createEventArgs(e.currentTarget, e);
892895
if (args.cell && isDefined(args.cell.expanded)) {

packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/pivotGrid.tests.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,26 @@ QUnit.module('dxPivotGrid', {
522522
assert.strictEqual(expandValueChangingArgs, undefined);
523523
});
524524

525+
QUnit.test('keydown auto-repeat does not trigger expansion', function(assert) {
526+
let expandValueChangingArgs;
527+
const pivotGrid = createPivotGrid({
528+
dataSource: this.dataSource,
529+
onExpandValueChanging: function(args) {
530+
expandValueChangingArgs = $.extend({}, args);
531+
}
532+
});
533+
assert.ok(pivotGrid);
534+
535+
const $collapsedTd = $('#pivotGrid').find('.dx-pivotgrid-collapsed').closest('td');
536+
assert.strictEqual($collapsedTd.length, 1);
537+
538+
$collapsedTd.trigger($.Event('keydown', { key: 'Enter', repeat: true }));
539+
540+
this.clock.tick(10);
541+
542+
assert.strictEqual(expandValueChangingArgs, undefined);
543+
});
544+
525545
QUnit.test('onCellClick cancel prevents keyboard expansion', function(assert) {
526546
let expandValueChangingArgs;
527547
const pivotGrid = createPivotGrid({

0 commit comments

Comments
 (0)