[Bug]: MessageBar announces the title and body without a space between them
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react, typescript
- Lĩnh vực
- accessibility, frontend
Hướng nghiên cứu
Bắt đầu trong useMessageBarBase_unstable, nơi chuỗi được thông báo được tạo từ bodyRef.current?.textContent, và xem cách danh sách hành động cũng được thêm vào; khoảng trắng mà người dùng có thị lực nhìn thấy chỉ đến từ quy tắc ::after { content: ' ' } trong useMessageBarTitleStyles.styles.ts, mà textContent không bao gồm. Chọn một trong hai cách tiếp cận mà người báo lỗi phác thảo (tổ hợp thông điệp từ tiêu đề, phần còn lại của body và từng hành động là cách cũng sửa các hành động), sau đó cập nhật các kỳ vọng 'TitleBody' và 'TitleBody,Action 1Action 2' trong MessageBar.test.tsx. Hoàn tất nghĩa là chuỗi được thông báo đọc là You're offline Keep working as usual. và các hành động được phân tách như Undo, View, với các bài kiểm thử MessageBar hiện có đều vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Component
MessageBar
Package version
9.75.2
React version
19.3.1
Environment
System:
OS: Windows 11 10.0.26200
CPU: 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
Memory: 15.7 GB
Binaries:
Node: 26.13.1
npm: 12.2.3
npmPackages:
@fluentui/react-components: 9.75.2 => 9.75.2
@fluentui/react-message-bar: 9.7.9 => 9.7.9
react: 19.3.1 => 19.3.1
react-dom: 19.3.1 => 19.3.1
Current Behavior
When a MessageBar has a MessageBarTitle followed by body text, the message it announces has no space between the two.
<MessageBar>
<MessageBarBody>
<MessageBarTitle>You're offline</MessageBarTitle>
Keep working as usual.
</MessageBarBody>
</MessageBar>
announce is called with You're offlineKeep working as usual., and that is the text AriaLiveAnnouncer puts in its live region. The visible text has a space there, so the announcement joins two words that sighted users see apart.
The cause, on master:
useMessageBarBase_unstablebuilds the message frombodyRef.current?.textContent.MessageBarTitleseparates itself from the body only with generated content,'::after': { content: '" "' }inuseMessageBarTitleStyles.styles.ts. Generated content is not part oftextContent.- JSX drops the line break between
</MessageBarTitle>and the body text, so there is no text space either. Every MessageBar story is written this way.
The actions are joined the same way. With two action buttons, Undo and View, the message ends in ,UndoView.
MessageBar.test.tsx currently expects the joined strings: 'TitleBody' and 'TitleBody,Action 1Action 2'.
Output of the script in the reproduction link, with @fluentui/[email protected]:
CASE 1 title and body
announced: "You're offlineKeep working as usual."
CASE 2 title, body and two actions
announced: "SavedYour changes are stored.,UndoView"
CASE 3 text space after the title (workaround)
announced: "You're offline Keep working as usual."
I also checked it in a browser, with a Cypress component test on master (4f812d44, Electron 130). getComputedStyle(title, '::after').content is " ", the body's textContent is You're offlineKeep working as usual., and the live region of AriaLiveAnnouncer receives that same text.
Expected Behavior
The announced message keeps the word boundaries of the visible text:
You're offline Keep working as usual.for a title and a body.- A separator between the labels of the actions, for example
Undo, View.
Two ways I can see to get there:
- Build the message in
useMessageBarBase_unstablefrom the title, the rest of the body and each action as separate parts, joined with a separator. - Give
MessageBarTitlea real text space in place of the::aftercontent.
The first one keeps the DOM as it is today and also covers the actions.
Reproduction
https://gist.github.com/jakesalvesen/aa3c59dc073b94b0c011c67ba45028b7
Steps to reproduce
- In an empty directory run
npm i @fluentui/[email protected] react@19 react-dom@19 jsdom. - Save
repro.cjsfrom the gist and runnode repro.cjs. App.jsxshows the first case through the public API withAriaLiveAnnouncer. Click the button with a screen reader running.
The script renders three MessageBars inside an AnnounceProvider and prints the string each one passes to announce. The third one has a {' '} after the title, which is the workaround.
Are you reporting an Accessibility issue?
yes
Suggested severity
Medium - Has workaround
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
- Check that there isn't 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 15 giờ
- Pull request đã merge (30 ngày)
- 74
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
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Toaster throws in development when it has a style propCó thể đã có người làm @jakesalvesen đã nhận 35 ngày trước. Đang mởComponent: Toast 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]: AriaLiveAnnouncer holds back a message announced in the commit that mounts itCó thể đã có người làm @dmytrokirpa đã nhận 2 ngày trước. Đang mởArea: Accessibility 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 85/100
microsoft/fluentui#37202 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: fluent-radio-group ignores value changes while disabledCó thể đã có người làm @chrisdholt đã nhận 1 ngày trước. Đang mởFluent UI WC (v3) web-components
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
microsoft/fluentui#37198 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Accordion crashes for scalar `defaultOpenItems={0}` (headless and styled v9)Có thể đã có người làm @arniebradfo đã nhận 22 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
Tất cả issue của microsoft/fluentui
Issue tương tự
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Có thể đã có người làm @goranai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checksCó thể đã có người làm @Raj1v đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
backnotprop/plannotator#4046 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
進捗部屋の管理画面で削除対象を月ごとに絞り込むĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
traPtitech/knoQ_R-UI#290 ·
Maintainer thường phản hồi trong vòng 24 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
farion1231/cc-switch#9981 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
account bug course exam iris lecture
Độ 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 1 ngày