[charts] Show axis tooltip when navigating with keyboard#21689
Draft
[charts] Show axis tooltip when navigating with keyboard#21689
Conversation
Modify selectorChartsInteractionTooltipXAxes and selectorChartsInteractionTooltipYAxes to support keyboard navigation by checking lastInteraction and using the focused item's axis index when lastInteraction === 'keyboard'. Co-authored-by: alexfauquette <45398769+alexfauquette@users.noreply.github.com>
|
Deploy preview: https://deploy-preview-21689--material-ui-x.netlify.app/ Bundle size report
|
Co-authored-by: alexfauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: alexfauquette <45398769+alexfauquette@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add axis tooltip for keyboard navigation in charts
[charts] Show axis tooltip when navigating with keyboard
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
trigger="axis"tooltip, keyboard navigation did not trigger the tooltip — only pointer interaction did. The item tooltip (trigger="item") already supported keyboard navigation viaselectorChartsTooltipItemswitching onlastInteraction === 'keyboard', but the axis tooltip selectors had no equivalent path.Changes
useChartCartesianTooltip.selectors.ts: Added keyboard-aware branching toselectorChartsInteractionTooltipXAxesandselectorChartsInteractionTooltipYAxes. WhenlastInteraction === 'keyboard', the selectors now useselectorChartsKeyboardXAxisIndex/selectorChartsKeyboardYAxisIndexto derive the axis data index from the focused item, instead of the pointer position. ThetriggerTooltipflag is still respected.Extracted a shared
getKeyboardAxisTooltiphelper to avoid duplicating the keyboard branch logic across X and Y selectors.contentDisplayed.test.tsx: Added browser test verifying that keyboard navigation (ArrowRight) displays the correct axis tooltip content whentrigger="axis"is set.This follows the same pattern already used in
useChartCartesianHighlight.selectors.ts, which already combined pointer and keyboard axis indices for axis highlight behavior.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.