tusen-ai/naive-ui

Feature request: better ARIA support and less click listeners

Open

#41 geöffnet am 9. Juni 2021

Auf GitHub ansehen
 (12 Kommentare) (5 Reaktionen) (0 zugewiesene Personen)TypeScript (14.240 Stars) (1.531 Forks)batch import
a11yfeature requesthelp wantedpr welcome

Beschreibung

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.

Contributor Guide