Disabling buttons is confusing
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 3.9k
- Fork
- 697
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 51
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của primer/react
-
PageHeader.Title does not seem to accept id propCó thể đã có người làm @TylerJDev đã nhận 3 ngày trước. Đang mởcomponent: PageHeader react staff
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
primer/react#8474 · 1 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
The padding prop seems to have no effect with PageLayout.SidebarCó thể đã có người làm @minwookshin đã nhận 15 ngày trước. Đang mởcomponent: PageLayout react staff
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
primer/react#8470 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug component: Spinner react
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
primer/react#8423 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Low contrast in SelectĐang mởwaiting for author response
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
primer/react#8172 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Checkbox: replace useLayoutEffect with ref callback for indeterminate propCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởcomponent: Checkbox react
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/rocketmq-dashboard#6872 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fab-geocommuns/RNB-site#539 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Guest multiview tile label leaks raw virtual-source-id "Whip" instead of the guest name / slot labelĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Eyevinn/open-live-studio#211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 72/100
sujithputta02/Esapay#13 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ehmpathy/rhachet-roles-bhuild#468 ·
Maintainer thường phản hồi trong vòng 1 ngày