[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapper
維護者通常 2 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 56/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- css, playwright, python, react, typescript
研究方向
從 components/dash-core-components/src/fragments/Dropdown.tsx(帶有 aria-hidden 與 tabIndex 的隱藏 input.dash-dropdown-focus-target)以及 src/components/css/dropdown.css(其 absolute 定位、寬度無限制)著手。使用 issue 中的最小版面重現,檢查 document.documentElement.scrollWidth,並執行 axe-core 以找出 aria-hidden-focus 違規。完成條件為:焦點目標不再加寬頁面,且 aria-hidden 內部不含任何可聚焦內容,同時保留該規避方案所針對的 Safari 分頁鍵順序行為;檢查 dash-core-components 測試套件中既有的 Dropdown 測試仍通過。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- Python
- 星號
- 24.5k
- 分支
- 2.3k
- 平均合併
- 3 天 2 小時
- 30 天內合併 PR
- 28
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/dash 的其他 Issue
-
P2 plotly-internal size: 1 task
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆
-
Extract graph schema validation into properly named test可能已有人在做 @Nice6042 於 68 天前認領。 未關閉good first issue P3 size: 1 task
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 2 天內回覆
-
[Performance] Slow serialisation of callback responses可能已有人在做 @T4rk1n 於 6 天前認領。 未關閉bug P2 size: 1
難度 3/5 1-2 天 新手友好度 45/100
維護者通常 2 天內回覆
-
P3 plotly-internal size: 10+ task
難度 5/5 一週以上 新手友好度 30/100
維護者通常 2 天內回覆
-
P2 plotly-internal size: 5 task
難度 4/5 3-5 天 新手友好度 35/100
維護者通常 2 天內回覆
相似的 Issue
-
Uninstall guide omits the CloudWatch log groups AWS CodeBuild creates for useCodeBuild pipelines未關閉bug documentation
難度 1/5 1-3 小時 新手友好度 88/100
awslabs/visual-asset-management-system#552 ·
維護者通常 1 天內回覆
-
netbox status: needs triage type: documentation
難度 1/5 1 小時以內 新手友好度 76/100
netbox-community/netbox#23460 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
awslabs/threat-composer#362 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
ansys/pyansys-common-mcp#213 ·
維護者通常 3 天內回覆