tremorlabs / tremor

React components to build charts and dashboards
https://npm.tremor.so
Apache License 2.0
16.13k stars 463 forks source link

Support focus style for focusable components #305

Open gokulkrishh opened 1 year ago

gokulkrishh commented 1 year ago

I am using DateRangepicker component in an app, it is focusable but there is no indicator for it like border or outline.

This is issue is request for supporting it, example i used here is DateRangepicker but ideally it should be supported by all focusable inputs, buttons etc,.

How it is now

Screenshot 2023-02-16 at 9 05 01 AM

How it can be

Screenshot 2023-02-16 at 9 05 30 AM

Screenshot 2023-02-16 at 9 05 50 AM

birjj commented 1 year ago

This is a general accessibility concern that tremor doesn't seem to have handled. Just to add a bit to the list, the following components have problematic styling for keyboard navigation in either Chrome or Firefox:

(sad cat 😿 indicates problem that makes keyboard interaction near unusable, usually due to removed focus indicator)

Accordion 😿 Corners of outline cut off on Chrome, no outline in Firefox (😿): ![image](https://user-images.githubusercontent.com/4542461/219324365-974417f5-6c70-4b60-847b-b390f184d54f.png)
Buttons Normal buttons have good focus styling (🎉), but light variants have a white outline that is almost invisible in both Chrome and Firefox: ![image](https://user-images.githubusercontent.com/4542461/219327342-2219f891-d839-43e7-994a-1f6669fa5b33.png)
Date Range Picker 😿 No outline for root elements in Chrome (😿). Good outline in Firefox (🎉): ![image](https://user-images.githubusercontent.com/4542461/219328279-652d2b52-2816-4543-a9ce-0a9f26ff35bd.png) Good (but inconsistent) outlines for internal elements in both Chrome and Firefox. Slightly nit-picky, but keyboard interaction in the date picker would be nice, so Up / Down / Left / Right works, would be nice. The current native implementation (Tab / Enter supported) works, but isn't necessarily intuitive.
Dropdown 😿 No outline in Chrome (😿). Good outline in Firefox (🎉): ![image](https://user-images.githubusercontent.com/4542461/219329182-707c5569-d7e1-4529-b859-88e9a4acccea.png) The options in the dropdown have an outline shown, but they are cut off: ![image](https://user-images.githubusercontent.com/4542461/219331809-b852b811-2505-46c7-945e-28b676989a7b.png) The dropdown has keyboard interaction implemented ***(🎉!!!)***, so Up, Down and Esc works - but the styling is different when using Tab.
Text input No outline in Chrome or Firefox. There is a very weak focus indicator (blinking cursor), but that is insufficient: ![image](https://user-images.githubusercontent.com/4542461/219329560-751e808a-2ad1-45c3-9e0a-3cc5b31e8028.png)
Select 😿 **For single selects:** The currently chosen text is targetable in both Chrome and Firefox. It is usually used to filter the list of options when the select is open, but does nothing when the select is closed. It also does not open the select when hitting Enter. The arrow is focusable and opens the select (🎉). The options in the dropdown have an outline shown, but they are cut off: ![image](https://user-images.githubusercontent.com/4542461/219331809-b852b811-2505-46c7-945e-28b676989a7b.png) The select has keyboard interaction implemented ***(🎉!!!)***, so Up, Down and Esc works - but the styling is different when using Tab. **For multi selects:** No outline in Chrome (😿): ![image](https://user-images.githubusercontent.com/4542461/219334432-4af519b6-e832-4b72-8b66-03c8954b0e22.png) Internal outlines work in both Chrome and Firefox. The select has keyboard interaction implemented ***(🎉!!!)***, but there is an inconsistency: if you use native interaction (Tab), then Enter doesn't select the option, Space does. If you use the custom implementation (Up / Down) then it's the inverse. Slightly nit-picky, but it would be nice if the search field was focused when the multi-select is opened, so users can immediately type to search.
Tabs 😿 No outline in Chrome (😿): ![image](https://user-images.githubusercontent.com/4542461/219332661-a06516a2-a327-42a5-8fbc-de85b36b6e45.png)
Toggle (nit-pick) Slightly nit-picky, but keyboard interaction would be nice, so Left / Right works, would be nice. The current native implementation (Tab / Enter supported) works, but isn't necessarily intuitive. Outlines are shown in both Chrome and Firefox (🎉)
gokulkrishh commented 1 year ago

@birjj Thanks for sharing your thoughts and inputs. Having a accessible inputs should also be goal a of library imo. Lets wait for Tremor team to reply and see what they have in mind to told this problem.

christopherkindl commented 1 year ago

Thank you for raising this concern! Also congrats to @gokulkrishh for the launch of expense.fyi ☺️

Accessibility is not covered yet as we are still in beta. We are currently incorporating it for the production-ready version that will be released soon.

Thank you for patience and using our library! 🙏

gokulkrishh commented 1 year ago

@christopherkindl thanks and glad to know that A11Y support is in roadmap. Looking forward for the production version. Tremor is awesome keep up the good work. 🫡

mitrotasios commented 1 year ago

Yep, a lot of the points noted by @birjj will be addressed in the v2 which is supposed to be released at the end of this month. Thanks for listing these!

severinlandolt commented 1 year ago

WIP:

Focus Styling Status: 🟢🟠🔴

adnjoo commented 6 months ago

+1 for tab

I saw the base is headlessui tab so you can use e.g. ⬅️➡️ arrow keys to navigate through the tabs