fix(announcements): show the body in a critical modal, not the popover summary - #28
Merged
Merged
Conversation
…r summary The alert flavour rendered `summary` — the two-line teaser the bell popover shows — so everything an author wrote below the first paragraph never reached the reader. A critical announcement is the one kind whose instructions are the whole point, and the admin composer's preview showed the full body, so the text was proof-read and then silently dropped on the way out. Both flavours now render the markdown body, and the card is extracted into `AnnouncementModalCard` so the composer can render the real component instead of a look-alike that can drift from it again. Long bodies now scroll inside the card while the actions stay put: a blocking modal that pushes its own dismiss button past the bottom of the viewport is a trap, and a full critical body is long enough to do exactly that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
A critical announcement's modal rendered
announcement.summary— the two-line teaser written for the bell popover — so everything the author wrote below the first paragraph never reached the reader. On a notice whose entire purpose is to deliver instructions ("update to 0.14.3, droptokensDir, remove these scopes"), the reader got the headline and nothing else.The admin composer's preview showed the full body, so the text was proof-read and then silently dropped on the way out.
AnnouncementModal.tsx's own doc comment already said the alert flavour carries "a short body" — the implementation just never did.The fix
summarygoes back to being the popover's job; it is derived server-side from the body's first paragraph anyway, so showing both would only stutter.AnnouncementModalCard(exported), leavingAnnouncementModalwith only what makes it a dialog: backdrop,role="dialog", focus trap. sphere-backoffice's composer preview now renders that card instead of its own look-alike — which is what stops the two drifting apart again.Nothing changes for consumers:
AnnouncementModal's props and behaviour are unchanged.Tests
Two new tests in
AnnouncementModal.test.tsx, both verified to fail against the previous component:vitest run— 171 passed (23 files).npm run lintis not runnable in this repo: it has neither eslint nor an eslint config installed.