elastic / elastic-charts

https://elastic.github.io/elastic-charts/storybook
Other
366 stars 116 forks source link

[Legend] Focus on data series after click #2443

Open gvnmagni opened 3 months ago

gvnmagni commented 3 months ago

After clicking on data series a persistent focus state get applied to the latest one clicked. The result of this is a little misleading and I would suggest to avoid it when clicking leaving the focus state for keyboard navigation.

@MichaelMarcialis any suggestion or idea if we deal with something similar in EUI?

May-30-2024 11-44-11

@markov00 identified where this behavior has been introduced: https://github.com/elastic/elastic-charts/pull/880#pullrequestreview-529256917

MichaelMarcialis commented 3 months ago

Hey, @gvnmagni! Based on your example, it looks like that styling is being applied on :focus of the legend item, instead of :focus-visible. By switching to :focus-visible, that should make it so the focus styles only show when necessary. In this case, that means this style would no longer be shown on click, but would show if the user attempts keyboard focus.

Also, I would recommend something like the following styles for the various states of the legend items (for consistency with EUI and better indication as to the individual clickable areas).

CleanShot 2024-06-03 at 17 35 50

gvnmagni commented 3 months ago

thank you @MichaelMarcialis!