Replace vendored floating-ui in FloatingDOMController with CSS Anchor Positioning
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 38/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- css, html, typescript
调研方向
Start with FloatingDOMController and its vendored floating-ui code, focusing on the affected uses of the global window and the iframe failure described in RedHat-UX/red-hat-design-system#2969. Review the proposed @supports-gated CSS anchor positioning and browser timeline, then verify the iframe fix and the native positioning path against the existing behavior before removing the JavaScript path after October 2026.
由索引模型根据 Issue 内容生成。
描述
Summary
CSS Anchor Positioning reached Baseline in January 2026 (Chrome 125+, Safari 26+, Firefox 147+). The ~1400 lines of vendored floating-ui code in FloatingDOMController can be replaced with native popover attribute + CSS anchor positioning.
Current problems with the vendored code
The vendored floating-ui has diverged from upstream. Several functions use the bare global window where upstream uses getWindow(node) (i.e. node.ownerDocument.defaultView). This causes infinite recursion and stack overflow when components using FloatingDOMController are rendered inside same-origin iframes (see RedHat-UX/red-hat-design-system#2969).
What CSS Anchor Positioning replaces
| Vendored floating-ui code | CSS replacement |
|---|---|
calculatePosition, computeCoordsFromPlacement, all rect/offset math (~600 lines) |
anchor-name, position-anchor, anchor() function |
| Flip middleware, fallback placements loop | position-try-fallbacks, @position-try |
| Shift middleware, overflow detection | position-area + viewport-aware clamping |
autoUpdate with ResizeObserver/IntersectionObserver/scroll listeners |
Not needed -- browser recalculates natively |
getOffsetParent, getContainingBlock, isContainingBlock |
Not needed -- popover promotes to top layer, escaping containing blocks |
| Arrow positioning | anchor() function on the arrow pseudo-element |
| RTL handling | CSS logical properties (already baseline) |
Timeline
| Milestone | Date |
|---|---|
| Firefox 147 ships anchor positioning | Jan 2026 |
| Firefox ESR 153 (includes anchor positioning) launches | Jul 2026 |
| Firefox ESR 140 (no anchor positioning) EOL | Oct 2026 |
October 2026 is the earliest clean cutover for projects supporting Firefox ESR.
Polyfill considerations
The @oddbird/css-anchor-positioning polyfill (~8KB gzipped) exists but has limitations that make it unsuitable for component libraries:
- Cannot work with constructed stylesheets (how Lit delivers CSS)
- Only processes styles present at call time
- Cross-shadow-root anchoring unsupported
- Global side effects even in "ponyfill" mode
Migration approach
- Fix the iframe
windowbug now (one-line fix per affected function) - Keep JS positioning as the engine through ESR 140's lifetime
- Write CSS anchor positioning alongside, gated by
@supports (anchor-name: --a) - Drop JS positioning path after Oct 2026
References
- 主要语言
- TypeScript
- 星标
- 394
- 派生
- 107
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
patternfly/patternfly-elements 的其他 Issue
-
bug
patternfly/patternfly-elements#3158 · 已指派 1 人 ·
-
patternfly/patternfly-elements#3136 · 1 条评论 · 已指派 1 人 ·
-
docs
patternfly/patternfly-elements#3131 · 已指派 1 人 ·
-
难度 4/5 3-5 天 新手友好度 55/100
patternfly/patternfly-elements#3122 ·
-
难度 5/5 一周以上 新手友好度 25/100
patternfly/patternfly-elements#3110 ·
查看 patternfly/patternfly-elements 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·