Disabling buttons is confusing
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
这个 Issue 还没有评估数据。
描述
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
- 主要语言
- TypeScript
- 星标
- 3.9k
- 派生
- 705
- 平均合并
- 3 天 1 小时
- 30 天内合并 PR
- 71
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
primer/react 的其他 Issue
-
PageHeader.Title does not seem to accept id prop可能已有人在做 @TylerJDev 于 11 天前认领。 未关闭component: PageHeader react staff
难度 2/5 1-3 小时 新手友好度 72/100
primer/react#8474 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
-
The padding prop seems to have no effect with PageLayout.Sidebar可能已有人在做 @minwookshin 于 23 天前认领。 未关闭component: PageLayout react staff
难度 2/5 1-3 小时 新手友好度 68/100
primer/react#8470 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug component: Spinner react
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
waiting for author response
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
Checkbox: replace useLayoutEffect with ref callback for indeterminate prop可能已有人在做 @akshat-lakhera 于 3 天前认领。 未关闭component: Checkbox react
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
area: image-engine bug priority: low
难度 2/5 1-3 小时 新手友好度 88/100
snapotter-hq/SnapOtter#3885 ·
维护者通常 1 天内回复
-
Mend: dependency security vulnerability
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 3 天内回复
-
pending triage
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug P3 UI/UX
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
难度 2/5 1-3 小时 新手友好度 73/100
openclaw/openclaw#182077 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复