Skip to content

feat(charts): Improve accessibility with keyboard interaction#1964

Open
akashsonune wants to merge 3 commits into
mainfrom
feat/charts-keyboard-interaction
Open

feat(charts): Improve accessibility with keyboard interaction#1964
akashsonune wants to merge 3 commits into
mainfrom
feat/charts-keyboard-interaction

Conversation

@akashsonune

@akashsonune akashsonune commented Apr 27, 2026

Copy link
Copy Markdown
Member
  • Traverse legend items with arrow keys (custom legend only)
  • Select/Unselect legend item with Enter/space
  • Tab to move to charts view with tooltip opened
  • Traverse through each data point with arrow keys
  • Escape to close tooltip
  • Use Shift +/- Shift arrows home to operate zoom slider

Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from b356d7e to 2edee9c Compare April 27, 2026 17:48

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request implements accessibility features for charts, including keyboard navigation for data points, zoom sliders, and legends, as well as ARIA support and live announcements. The review feedback identifies several TypeScript style guide violations regarding the use of the any type and suggests improvements for ARIA label redundancy and legend navigation logic.

Comment thread projects/charts-ng/common/si-chart-base.component.html Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
Comment thread projects/charts-ng/common/si-chart-base.component.ts Outdated
@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch 4 times, most recently from 1778050 to e3e5eba Compare April 27, 2026 19:50
@akashsonune akashsonune requested review from dr-itz and panch1739 April 27, 2026 19:55
@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch 2 times, most recently from 83b4548 to c311421 Compare April 28, 2026 07:29
@dr-itz

dr-itz commented Apr 28, 2026

Copy link
Copy Markdown
Member

Focus is barely visible, needs to be in our focus color. Why not just have the focus border around the whole element?
Screenshot 2026-04-28 at 13 44 35

@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from c311421 to 21eb1b1 Compare April 28, 2026 13:59
@akashsonune

Copy link
Copy Markdown
Member Author

Focus is barely visible, needs to be in our focus color. Why not just have the focus border around the whole element? Screenshot 2026-04-28 at 13 44 35

done. Not sure about focusing the whole element, I see that the other libs like carbon focus just the legend icon. Maybe we can discuss this along with ux

@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from 21eb1b1 to 790fd7c Compare April 28, 2026 18:32
@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from 790fd7c to 0f8f511 Compare June 17, 2026 14:07
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

⬇️ Download VRTs

@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from 0f8f511 to aa74c74 Compare June 17, 2026 18:52
@akashsonune akashsonune force-pushed the feat/charts-keyboard-interaction branch from aa74c74 to a222173 Compare June 17, 2026 18:57
@akashsonune akashsonune marked this pull request as ready for review June 18, 2026 05:54
@akashsonune akashsonune requested review from a team as code owners June 18, 2026 05:54
@akashsonune

Copy link
Copy Markdown
Member Author

@dr-itz can you take a look

@akashsonune

Copy link
Copy Markdown
Member Author

@dr-itz can you review

@dr-itz dr-itz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Examples aren't live any more, so I cannot test. Also, please squash the commits

host: {
'[attr.tabindex]': '!showCustomLegend() ? 0 : null',
'[attr.role]': '!showCustomLegend() ? "application" : null',
'[attr.aria-label]': '!showCustomLegend() ? (title() || "Chart") : null',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should not hard-code any labels

Comment on lines +817 to +820
legendItems[legendIdx + 1]?.focus();
} else if (event.key === 'ArrowLeft') {
event.preventDefault();
legendItems[legendIdx - 1]?.focus();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this need different direction in case of RTL?

@spike-rabbit spike-rabbit added this to the 51.x milestone Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants