Disabling buttons is confusing
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
As noted in #7879, there are three separate ways to disable a button:
disabledaria-disabledinactive
Our accessibility guidance generally discourages disabled because it makes buttons inaccessible by keyboard navigation, which may make them undiscoverable to screen readers. So I avoid this.
aria-disabled generally seems to work well, making buttons visually disabled while leaving them focusable and ensuring that screen reader users understand they are disabled. So I'm tempted to just reach for aria-disabled all the time.
However, there is also the inactive prop, and it's not clear why this exists or when we should prefer it over aria-disabled. Visually they are distinct, which makes inactive buttons visually inconsistent with other buttons. And inactive completely overrides variant. To be honest, inactive feels redundant, with limited functionality - I'm tempted to avoid it altogether.
There's a docs section on what an inactive button is:
An inactive Button is an accessible alternative to a disabled Button. They're intended to be used for buttons that are non-functional, but cannot be removed from the page.
Unlike a disabled Button, an inactive Button can respond to user input. For example, if a Button shows a tooltip when hovered or focused, or a Dialog when clicked.
But this just raises more questions than it answers - why would I use inactive if I can get exactly the same functionality from aria-disabled but with much better styling and variant support?
Possible solutions
Ideally we need to create explicit clarity around the correct way to disable buttons, without making consumers dig through several different docs to try and determine this for themselves.
I would propose the following:
- Deprecate and remove the
inactiveprop in favor ofaria-disabled - Lint against the
disabledprop in favor ofaria-disabled - Document that
aria-disabledis the preferred approach
Alternatively, we could lean on inactive instead:
- Improve
inactiveso that it works likearia-disabled, supporting variant styling - Lint against
disabledandaria-disabledin favor ofinactive - Document that
inactiveis the preferred approach
- Lingua principale
- TypeScript
- Stelle
- 3.9k
- Fork
- 697
- Merge medio
- 3g 12h
- PR unite (30g)
- 51
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di primer/react
-
PageHeader.Title does not seem to accept id propForse già presa @TylerJDev l’ha presa 3 giorni fa. Apertacomponent: PageHeader react staff
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
primer/react#8474 · 1 commento · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
The padding prop seems to have no effect with PageLayout.SidebarForse già presa @minwookshin l’ha presa 15 giorni fa. Apertacomponent: PageLayout react staff
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
primer/react#8470 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
bug component: Spinner react
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
primer/react#8423 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Low contrast in SelectApertawaiting for author response
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
primer/react#8172 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Checkbox: replace useLayoutEffect with ref callback for indeterminate propForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertacomponent: Checkbox react
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di primer/react
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/rocketmq-dashboard#6872 ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
fab-geocommuns/RNB-site#539 ·
I maintainer di solito rispondono entro 2 giorni
-
Guest multiview tile label leaks raw virtual-source-id "Whip" instead of the guest name / slot labelAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Eyevinn/open-live-studio#211 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
sujithputta02/Esapay#13 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ehmpathy/rhachet-roles-bhuild#468 ·
I maintainer di solito rispondono entro 1 giorno