tusen-ai/naive-ui

Feature request: better ARIA support and less click listeners

Open

#41 aperta il 9 giu 2021

Vedi su GitHub
 (12 commenti) (5 reazioni) (0 assegnatari)TypeScript (1531 fork)batch import
a11yfeature requesthelp wantedpr welcome

Metriche repository

Star
 (14.240 star)
Metriche merge PR
 (Merge medio 16g 16h) (14 PR mergiate in 30 g)

Descrizione

What problem does the feature solve?

I find there're two issues on the doc website:

  • some clickable targets have no [role="button"], like dropdown menuitems, radio buttons and breadcrumbs
  • some non-clickable components has click listeners, like tags
  • some disabled components still has click listeners but no [aria-disabled] is added, like cascader menuitems and checkboxes
  • usually a <input> is wrapped by <div>s, and the div.n-input has a click listener but without [aria-hidden=true]

What does the proposed API look like?

I have an extension "Vimium C" to help users use keyboard to click page elements, and when it find links, it will pick those with [role=button], [role=link] and filter out those [aria-hidden], [aria-disabled], [aria-hidden=true], [aria-disabled=true]. It also hooks the global addEventListener function to learn what "plain" elements are clickable.

When I tested Vimium C's LinkHints.activate (triggered by f) on pages like https://www.naiveui.com/zh-CN/os-theme/components/input , I found many clickable were not recognized, while many others were mistakenly hinted.

So I want this framework to add more clues to let such keyboard helper extensions work better.

Guida contributor