[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapper
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 56/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- css, playwright, python, react, typescript
- Lĩnh vực
- accessibility, frontend
Hướng nghiên cứu
Bắt đầu từ components/dash-core-components/src/fragments/Dropdown.tsx (input.dash-dropdown-focus-target ẩn với aria-hidden và tabIndex) và src/components/css/dropdown.css (việc định vị absolute, chiều rộng không giới hạn). Tái hiện với bố cục tối thiểu trong issue, kiểm tra document.documentElement.scrollWidth và chạy axe-core cho vi phạm aria-hidden-focus. Hoàn thành khi mục tiêu focus không còn làm rộng trang và không có nội dung có thể focus nằm trong aria-hidden, đồng thời giữ nguyên hành vi thứ tự tab trên Safari mà cách giải quyết hướng tới; kiểm tra các bài kiểm tra Dropdown hiện có trong bộ kiểm tra của dash-core-components vẫn vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Thank you for Dash!
Describe your context
dash 4.5.0rc0
(the same code is on dev today: components/dash-core-components/src/fragments/Dropdown.tsx and src/components/css/dropdown.css)
- OS: Linux
- Browser: Chromium 151 (headless, via Playwright) with axe-core
Describe the bug
The hidden input.dash-dropdown-focus-target that dcc.Dropdown renders (the Safari tab-order workaround) causes two problems:
-
It is focusable inside
aria-hidden. It hasaria-hidden="true"andtabIndex={0}(while the trigger<button>istabIndex={-1}), so the only tab stop for every dropdown is hidden from assistive technology. axe-core reportsaria-hidden-focus(serious) once perdcc.Dropdownon the page: "Focusable content should be disabled or be removed from the DOM". -
It can widen the page. Its CSS is only
position: absolute; opacity: 0; pointer-events: none;, so it keeps the browser's default input width (about 215px in Chromium) and is anchored atleft: 0of the wrapper. A dropdown narrower than that, near the right edge of a flex row, pushes the input past the viewport: in our app a 600px-wide viewport gotdocument.documentElement.scrollWidth === 648(horizontal scrolling on mobile). Addingmax-width: 100%(orwidth: 100%/inset: 0) to.dash-dropdown-focus-targetfixes it; we use this override for now:.dash-dropdown-wrapper .dash-dropdown-focus-target { max-width: 100%; }
Minimal example:
from dash import Dash, dcc, html
app = Dash(__name__)
app.layout = html.Div(
[html.Div(style={"flex": "1"}), dcc.Dropdown(["a", "b"], placeholder="Pick", style={"width": "140px"})],
style={"display": "flex", "width": "100%"},
)
if __name__ == "__main__":
app.run()
At a 200px-wide viewport, document.documentElement.scrollWidth is 237 because of the focus input, and axe-core reports one aria-hidden-focus violation on it.
Expected behavior
- No focusable element inside
aria-hidden. For example, droparia-hiddenfrom the workaround input and give it the dropdown's accessible name, or make the trigger button itself the tab stop where the browser supports it. I don't know which works best with the Safari behaviour the workaround targets. - The hidden input never takes more space than its wrapper (
max-width: 100%indropdown.css).
Screenshots
n/a
- Ngôn ngữ chính
- Python
- Star
- 24.4k
- Fork
- 2.3k
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọ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 plotly/dash
-
P2 plotly-internal size: 1 task
Độ 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
-
Extract graph schema validation into properly named testCó thể đã có người làm @Nice6042 đã nhận 57 ngày trước. Đang mởgood first issue P3 size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
plotly/dash#3735 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Linter/Type Checking ReplacementĐang mởP3 plotly-internal size: 10+ task
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
plotly/dash#4040 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Drop Python 3.9 SupportĐang mởP2 plotly-internal size: 5 task
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
plotly/dash#4038 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[BUG] Setting children to None leaves removed components registered: their callbacks keep firing and the subtree can never be mounted againCó thể đã có người làm @0d00ciallo0721 đã nhận 4 ngày trước. Đang mởbug P3 size: 3
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
plotly/dash#4033 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
awslabs/visual-asset-management-system#414 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug v1 v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
modelcontextprotocol/python-sdk#3670 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aicell-lab/bioengine#232 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
modelscope/evalscope#1836 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100