tusen-ai/naive-ui

Feature request: better ARIA support and less click listeners

Ouverte

#41 ouverte le 9 juin 2021

 (12 commentaires) (5 réactions) (0 personne assignée)TypeScript (1 531 forks)batch import
a11yfeature requesthelp wantedpr welcome

Métriques du dépôt

Stars
 (14 240 étoiles)
Métriques de merge PR
 (Merge moyen 16j 16h) (14 PRs mergées en 30 j)

Description

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.

Guide contributeur