Skip to content
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

enabled arrow navigation with Tabbable #33293

Draft
wants to merge 6 commits into
base: charting/web-components
Choose a base branch
from

Conversation

Anush2303
Copy link
Contributor

Previous Behavior

Bars and legends were not navigable with the help of arrow keys.

New Behavior

Bars and legends are now navigable with the help of arrow keys using Tabbable.

Related Issue(s)

  • Fixes #

@Anush2303 Anush2303 marked this pull request as ready for review November 19, 2024 09:30
@Anush2303 Anush2303 requested a review from a team as a code owner November 19, 2024 09:30
Copy link

Pull request demo site: URL

requestAnimationFrame(() => {
const legendContainer = this.shadowRoot?.getElementById('legend-div') as HTMLElement;
if (legendContainer) {
const legendButtons = tabbable.tabbable(legendContainer);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need tabbable for this? we already know which elements are focusable and we can select them easily.
you can refer to the implementations of the MenuList, RadioGroup, and Tablist web components to see how they handle this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, can select those elements directly also. That what is the functionality of Tabbale. It only helps in identifying the focusable elements.

const tabbableElements = tabbable.tabbable(rootDiv);
let currentIndex = 0;

rootDiv.addEventListener('keydown', (event: KeyboardEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

does pressing tab key still move focus to the next bar segment or does it move to elements in the next focusable group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It still moves to the next bar segment. Moving to the next bar is the functionality of Groupper which needs to be implemented separately like Arrow navigation.

@Anush2303 Anush2303 marked this pull request as draft November 20, 2024 06:39
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.

2 participants