Skip to content

PivotGrid A11y and KBN - The expand icons are not accessible via keyboard (KBN)#33709

Open
aleksei-semikozov wants to merge 20 commits into
DevExpress:26_1from
aleksei-semikozov:pivot-grid-kbn
Open

PivotGrid A11y and KBN - The expand icons are not accessible via keyboard (KBN)#33709
aleksei-semikozov wants to merge 20 commits into
DevExpress:26_1from
aleksei-semikozov:pivot-grid-kbn

Conversation

@aleksei-semikozov

Copy link
Copy Markdown
Contributor

No description provided.

@aleksei-semikozov aleksei-semikozov self-assigned this May 25, 2026
@aleksei-semikozov aleksei-semikozov force-pushed the pivot-grid-kbn branch 2 times, most recently from 05552a8 to 50e613c Compare May 25, 2026 21:31
@aleksei-semikozov aleksei-semikozov marked this pull request as ready for review May 29, 2026 13:06
@aleksei-semikozov aleksei-semikozov requested a review from a team as a code owner May 29, 2026 13:07
Copilot AI review requested due to automatic review settings May 29, 2026 13:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves dxPivotGrid accessibility/keyboard navigation by making expand/collapse controls operable via keyboard and exposing expanded state via ARIA attributes.

Changes:

  • Added keyboard handling so Enter/Space on expandable header cells toggles expansion.
  • Added aria-expanded and tabindex="0" to expandable header <td> elements.
  • Added QUnit coverage for keyboard toggling behavior and the new accessibility markup.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/pivotGrid.tests.js Adds keyboard-driven expand/collapse tests (Enter/Space and negative cases).
packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/pivotGrid.markup.tests.js Adds markup tests validating aria-expanded and tabindex for expandable vs non-expandable cells.
packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts Adds keydown handling on cells to toggle expansion via keyboard.
packages/devextreme/js/__internal/grids/pivot_grid/area_item/m_area_item.ts Adds aria-expanded and tabindex attributes to expandable header cells during rendering.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-expanded is valid on gridcell but not on cell (implicit role of <td> in a plain <table>). The pivot grid table has no role="grid". Was this tested with a screen reader?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it risky to rely on the absence of aria-expanded to identify a non-expandable cell? If aria-expanded is ever removed or renamed, this selector silently targets the wrong element. Wouldn't selecting by row/column index be more reliable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@bit-byte0 bit-byte0 May 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally and found out that _handleCellKeyDown delegates to _handleCellClick, which also triggers cell click handlers. Since a keyboard expand is not a click, shouldn't the expand/collapse logic be called directly instead?

@bit-byte0 bit-byte0 May 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabindex="0" makes the cell focusable, but outline: 0 is set on all tds in the PivotGrid styles, so there's no visible focus indicator. Keyboard users can't see which cell is focused. Shouldn't a focus style be added? At least I tested it locally and couldn't see a focus thing visually.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copilot AI review requested due to automatic review settings May 29, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts
Copilot AI review requested due to automatic review settings May 29, 2026 18:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts
Copilot AI review requested due to automatic review settings May 29, 2026 21:39
return;
}
e.preventDefault();
this._trigger('onCellClick', args);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CellClickEvent types event in d.ts as MouseEvent | PointerEvent. I'm not sure but now it may need KeyboardEvent added since onCellClick now fires from keyboard too

bit-byte0
bit-byte0 previously approved these changes Jun 4, 2026
Comment thread packages/devextreme-scss/scss/widgets/base/pivotGrid/_index.scss Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/area_item/m_area_item.ts Outdated
span.classList.add(PIVOTGRID_EXPAND_CLASS);
div.appendChild(span);
td.appendChild(div);
td.setAttribute('role', 'button');

@Tucchhaa Tucchhaa Jun 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with copilot. I am not sure if role=button is ok for table cells. I think we need to check screen readers output or discuss it with Andrey D.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copilot AI review requested due to automatic review settings June 5, 2026 14:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/area_item/m_area_item.ts Outdated
Copilot AI review requested due to automatic review settings June 5, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/m_widget.ts Outdated
Comment thread packages/devextreme/js/__internal/grids/pivot_grid/area_item/m_area_item.ts Outdated
Copilot AI review requested due to automatic review settings June 9, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.

Comment thread packages/devextreme/js/__internal/grids/pivot_grid/area_item/m_area_item.ts Outdated
Copilot AI review requested due to automatic review settings June 9, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 9 changed files in this pull request and generated 1 comment.

Comment thread packages/devextreme-scss/scss/widgets/base/pivotGrid/_index.scss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants