tusen-ai/naive-ui

Feature request: better ARIA support and less click listeners

Offen

#41 geöffnet am 09.06.2021

 (12 Kommentare) (5 Reaktionen) (0 zugewiesene Personen)TypeScript (1.531 Forks)batch import
a11yfeature requesthelp wantedpr welcome

Repository-Metriken

Stars
 (14.240 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 16T 16h) (14 gemergte PRs in 30 T)

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