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

KeyboardEvents not getting registered on legend itemContainers #3856

Open
shrane-ms opened this issue Oct 27, 2021 · 3 comments
Open

KeyboardEvents not getting registered on legend itemContainers #3856

shrane-ms opened this issue Oct 27, 2021 · 3 comments

Comments

@shrane-ms
Copy link

Bug description

KeyboardEvents not getting registered on legend itemContainers

I have registered the following events for legend items

chart.legend.itemContainers.template.events.on("over", console.log)
chart.legend.itemContainers.template.events.on("keydown", console.log, this)  
chart.legend.itemContainers.template.events.on("keypress", console.log, this)

Only the over pointer event is working and seems the only event to be registered.
The KeyboardEvents are not getting registered at all

On getting event listeners on legend item
only following events are found to be registered pointerout, blur, pointerover, pointerdown, touchstart, focus

https://codepen.io/itachi022/pen/LYjyJab

Checkout the above code pen

Environment (if applicable)
amcharts4

Additional context

We need to make the legend items navigable using arrow keys and need to listen to the keyboard events for this

@martynasma
Copy link
Collaborator

If you need to catch keyboard events you need to add them on a document, not legend item.

Then trigger focus on specific element using its isFocused accessor:

chart.legend.itemContainers.getIndex(0).isFocused = true;

@shrane-ms
Copy link
Author

@martynasma I want to make the legend items navigable using arrow keys, is there a config which will allow me to do this?

Currently if we make the legend items focusable, we have to Tab through these items.
If the number of legend items becomes more it is not a good experience for a user to Tab through these items, we should be able to move out of legend container in one tab.

@martynasma
Copy link
Collaborator

At this time we do not plan on making this change I'm afraid.

amCharts 4 is not getting any new features.

We might consider arrow-based selection in amCharts 5 at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants