[BUG] dcc.Dropdown: hidden focus-target input is focusable inside aria-hidden and can overflow its wrapper
维护者通常 2 天内回复
@KoolADE85 已经在做这个了。
开始于 2026年10月5日。
评估
- 难度
- 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.4k
- 派生
- 2.3k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 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 于 55 天前认领。 未关闭good first issue P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 68/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 天内回复
-
[BUG] Setting children to None leaves removed components registered: their callbacks keep firing and the subtree can never be mounted again可能已有人在做 @0d00ciallo0721 于 2 天前认领。 未关闭bug P3 size: 3
难度 4/5 3-5 天 新手友好度 62/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
rpm-software-management/mock#1824 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jpata/particleflow#520 ·
维护者通常 1 天内回复
-
bug good first issue hacktoberfest
难度 1/5 1 小时以内 新手友好度 78/100
gridhead/gi-loadouts#699 ·
维护者通常 13 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
FinanceFlash/unvibecode#206 ·
维护者通常 1 天内回复