Repository navigation
[charts] Focus the clicked item for keyboard navigation #23247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
c768cf6
[charts] Split the keyboard focus state into isFocused and isFocusVis…
JCQuintas 526c673
[charts] Expose the accessibility proxy element on the chart instance
JCQuintas df7aa1b
[charts] Add focusItem and focusChart to the keyboard navigation inst…
JCQuintas 93e7d23
[charts] Add the focusItemOnClick prop
JCQuintas 1434037
[charts] Focus the clicked item on every keyboard navigable series
JCQuintas e8012cd
[charts] Test the click to focus behavior
JCQuintas 1bedb13
[docs] Document click to focus and focusItemOnClick
JCQuintas 76e3fac
[charts] Resolve a click that hit no item from the axis
JCQuintas fe087cb
[charts] Test the theme default props and fix the documented componen…
JCQuintas c78d2c8
[charts] Focus the clicked item in RadarSeriesPlot
JCQuintas c149a2d
[charts] Resolve the axis fallback against the target series axis
JCQuintas 8049d3c
[charts] Do not claim a focus the chart could not take
JCQuintas 91a8a59
[charts] Keep the pointer cursor tied to onItemClick
JCQuintas 67b7f53
[docs] Document click to focus for custom components
JCQuintas 690ec24
[charts] Merge the focus entry points into one path
JCQuintas 13878a2
[charts] Leave the radial charts out of click to focus
JCQuintas b548ae3
[charts] Simplify the keyboard focus plugin
JCQuintas 2425de9
[charts] Cover the click resolution against a controlled highlight
JCQuintas 89515c5
[charts] Ignore a click that resolves to no item
JCQuintas 06271b6
[charts] Resolve the clicked item from the item under the pointer
JCQuintas 6c19282
wip-radar-split
JCQuintas f2c68fa
[charts] Register the tap listener in its own effect
JCQuintas b84cfe4
[charts-premium] Cover click to focus on the radial charts
JCQuintas 70de9c0
[charts] Keep the tooltip on the pointer when clicking an item
JCQuintas 450449d
Merge branch 'master' into feat/charts-click-to-focus
JCQuintas 9cb041f
[charts] Focus the tapped item on touch
JCQuintas 24e5800
Merge remote-tracking branch 'origin/feat/charts-click-to-focus' into…
JCQuintas dabcdd2
Merge remote-tracking branch 'upstream/master' into feat/charts-click…
JCQuintas 6077861
[charts] Drop a pending item when the click is stopped
JCQuintas a3bc928
Merge branch 'master' into feat/charts-click-to-focus
JCQuintas 925e599
[docs] Regenerate the API documentation after the merge
JCQuintas c5f4883
Merge remote-tracking branch 'origin/feat/charts-click-to-focus' into…
JCQuintas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All series currently tells the chart which item the pointer is over, which is how the tooltip and the highlight work. So click-to-focus could in theory ignore clicks entirely and just focus whatever is currently hovered, which would be simpler than this pr.
That would drop the changes to
useInteractionItemProps, so most of the diff, along with the merged click handler and the cursor adjustments it needed.The problem is that
highlightedItemandtooltipItemare controlled props. Once an app controls the highlight,setHighlightreturns early and the store stops following the pointer at all (useChartHighlight.ts#L105), so the stored item is whatever the app decided rather than what was clicked. On those charts you'd click one bar and focus another, silently, and only for people using a documented API. The tooltip item has the same catch.So there's no single reliable "item under the pointer" to read from, and each series has to report its own click instead.
@alexfauquette Question is, should highlight or tooltip control the focus? Or should the focus be independent? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, it's different. The highlight could be sync between different chart for other components. Which make no sens for focus.
Should we introduce an intermediate repesentation?
Disclaimer: I worked on it a long time ago so I might forget stuff
An initial reason why tooltip and highlight are handled differently because of edge cases. Mostly the fact that you can highlight a line series but not display a tooltip for it.
Currently, The tooltip and highlight work nearly the same way (When you see a
setTooltipItem(), thesetHighlightis not that far ;) )And the swich between focused/highlighted/controlled item is done by selector
Technically a solution could be:
highlight.itemandtooltip.itemThat was my 2 cents on this topic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexfauquette nice input, that managed to decrease the touched files from this PR by quite a few 😆