Skip to content

Commit f375658

Browse files
PivotGrid - Refine keyboard a11y per review feedback
1 parent 5354909 commit f375658

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

packages/devextreme-scss/scss/widgets/base/pivotGrid/_common.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
box-sizing: content-box;
7676
}
7777

78+
td[aria-expanded]:focus-visible {
79+
outline: 2px solid currentColor;
80+
outline-offset: -2px;
81+
}
82+
7883
.dx-area-description-cell {
7984
position: relative;
8085
background-clip: padding-box; // T379462

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ class PivotGrid extends Widget {
891891
const args = this._createEventArgs(e.currentTarget, e);
892892
if (args.cell && isDefined(args.cell.expanded)) {
893893
e.preventDefault();
894-
this._handleCellClick({ currentTarget: e.currentTarget, preventDefault: noop });
894+
this._handleCellClick(e);
895895
}
896896
}
897897
}

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ QUnit.module('dxPivotGrid', {
512512
});
513513
assert.ok(pivotGrid);
514514

515-
const $nonExpandableTd = $('#pivotGrid').find('td:not([aria-expanded])').first();
515+
const $nonExpandableTd = $('#pivotGrid').find('.dx-area-row-cell td').first();
516516
assert.ok($nonExpandableTd.length > 0);
517517

518518
$nonExpandableTd.trigger($.Event('keydown', { key: 'Enter' }));
@@ -522,6 +522,29 @@ QUnit.module('dxPivotGrid', {
522522
assert.strictEqual(expandValueChangingArgs, undefined);
523523
});
524524

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

0 commit comments

Comments
 (0)