[Bug]: Inherited CSS white-space cascades into shadow boundary; :host reset is not reliable
Maintainer thường phản hồi trong vòng 2 ngày
@radium-v đang làm issue này rồi.
Từ ngày 10/6/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Related Issue
Follow-up to #36282 — splitting into focused issues for clearer tracking.
Component
All components with shadow DOM
Package version
3.0.0-rc.15
@microsoft/fast-element version
2.10.4
Environment
System:
OS: macOS 15.7.7
CPU: (8) x64 Apple M2
Memory: 20.61 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Chrome: 149.0.7827.53
Edge: 148.0.3967.96
Safari: 26.0.1
npmPackages:
@fluentui/react-components: 9.73.8 => 9.73.8
@fluentui/web-components: 3.0.0-rc.15 => 3.0.0-rc.15
@microsoft/fast-element: ^2.10.4 => 2.10.4
Current Behavior
CSS properties like white-space inherit through the shadow boundary, affecting internal component rendering. When a parent sets white-space: pre or similar, it cascades into the component and changes layout behavior unexpectedly.
Additionally, using :host { white-space: normal; } as a defensive reset has a weakness — it can be overridden by greedy * selectors in consumer styles.
Current workarounds
- Consumer-side patch: Set
fluent-field { white-space: normal; }in light DOM - Component-side
:hostreset: Setwhite-space: normalon:hostin shadow stylesheet- ⚠️ Can be overridden by consumer
*selectors
- ⚠️ Can be overridden by consumer
Proposed Solutions
- Wrapper root element with
white-spacereset — Wrap template content in an element withwhite-space: normal(more resilient but changes DOM structure). A root element encapsulates more effectively than :host :hostreset forwhite-space— Addwhite-space: normalto:hostin component stylesheets (with caveat that consumer*selectors can override)- Eliminate whitespace from templates — Ship single-line templates in ESM (requires per-template care since some whitespace may be structural)
Expected Behavior
Components should encapsulate their internal styling and not be affected by inherited CSS properties from parent elements.
Reproduction
https://stackblitz.com/edit/vitejs-vite-vcgc2r59?file=src%2Fmain.js
Steps to reproduce
- Open the StackBlitz reproduction
- Observe how inherited
white-spacevalues affect component rendering - Try applying
:host { white-space: normal; }and note it can still be overridden
Are you reporting an Accessibility issue?
None
Suggested severity
Normal
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
- Check that there is not already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
- Ngôn ngữ chính
- TypeScript
- Star
- 20.4k
- Fork
- 3k
- Merge trung bình
- 3 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 104
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 microsoft/fluentui
-
[Bug]: Accordion crashes for scalar `defaultOpenItems={0}` (headless and styled v9)Có thể đã có người làm @arniebradfo đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Button shims in react-migration-v8-v9 always render the ms-Button--primary classCó thể đã có người làm @jakesalvesen đã nhận 13 ngày trước. Đang mởComponent: Button Fluent UI react-components (v9) Type: Bug :bug:
Độ 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
-
[Bug]: AreaChart renders SVG rect with negative width and height on initial renderCó thể đã có người làm @AtishayMsft đã nhận 9 ngày trước. Đang mởPackage: charting Type: Bug :bug:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microsoft/fluentui#36976 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Vertical Slider still logs the deprecated 'slider-vertical' warning in Chromium 132+Có thể đã có người làm @jakesalvesen đã nhận 16 ngày trước. Đang mởComponent: Slider Fluent UI react-components (v9) Type: Bug :bug:
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
microsoft/fluentui#36945 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: fluent-checkbox submits "on" when the checked attribute is before valueCó thể đã có người làm @FOWEPJF255 đã nhận 10 ngày trước. Đang mở
Độ 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
Tất cả issue của microsoft/fluentui
Issue tương tự
-
[fullsend] E2E: scorecard — filecheck GitLab entity metrics unavailable due to initialDelay timingĐang mởe2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redhat-developer/rhdh-plugin-export-overlays#4698 · 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 88/100
devswha/herdr-web-ui#2884 ·
-
Độ 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 1 ngày
-
b:minor bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
software-mansion/argent#1771 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Resources: New palettes of XiamenCó thể đã có người làm @rmt-svc đã nhận hôm nay. Đang mởresources
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 74/100
railmapgen/rmg-palette#2491 ·
Maintainer thường phản hồi trong vòng 4 ngày