[Bug]: MessageBar announces the title and body without a space between them
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- accessibility, frontend
Direzione di ricerca
Inizia in useMessageBarBase_unstable, dove la stringa annunciata viene costruita da bodyRef.current?.textContent, e osserva come viene aggiunto anche l'elenco delle azioni; lo spazio che vedono gli utenti vedenti proviene solo dalla regola ::after { content: ' ' } in useMessageBarTitleStyles.styles.ts, che textContent non include. Scegli uno dei due approcci delineati da chi segnala il problema (comporre il messaggio da titolo, resto del body e ciascuna azione è quello che corregge anche le azioni), poi aggiorna le aspettative 'TitleBody' e 'TitleBody,Action 1Action 2' in MessageBar.test.tsx. Fatto significa che la stringa annunciata recita You're offline Keep working as usual. e che le azioni sono separate come Undo, View, con i test MessageBar esistenti che passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 20.4k
- Fork
- 3k
- Merge medio
- 3g 15h
- PR unite (30g)
- 74
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/fluentui
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: Toaster throws in development when it has a style propForse già presa @jakesalvesen l’ha presa 35 giorni fa. ApertaComponent: Toast Fluent UI react-components (v9) Type: Bug :bug:
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: AriaLiveAnnouncer holds back a message announced in the commit that mounts itForse già presa @dmytrokirpa l’ha presa 2 giorni fa. ApertaArea: Accessibility Fluent UI react-components (v9) Type: Bug :bug:
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
microsoft/fluentui#37202 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: fluent-radio-group ignores value changes while disabledForse già presa @chrisdholt l’ha presa 1 giorno fa. ApertaFluent UI WC (v3) web-components
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/fluentui#37198 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: Accordion crashes for scalar `defaultOpenItems={0}` (headless and styled v9)Forse già presa @arniebradfo l’ha presa 22 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di microsoft/fluentui
Issue simili
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Forse già presa @goranai l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Inbox permission: an allow sent with `updatedInput` is ignored by Claude Code on its own safety checksForse già presa @Raj1v l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
backnotprop/plannotator#4046 ·
I maintainer di solito rispondono entro 1 giorno
-
進捗部屋の管理画面で削除対象を月ごとに絞り込むAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
traPtitech/knoQ_R-UI#290 ·
I maintainer di solito rispondono entro 24 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
farion1231/cc-switch#9981 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
account bug course exam iris lecture
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno