Repository navigation
fix(Banner): role="alert" covers the urgent message only; bind the urgent alert states - #6779
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentComposer | 120.1 kB (+83 B) · 1.9 kB CSS (0) | — | — · — · — |
| Banner · Storybook | 53.8 kB (+75 B) · 9.8 kB CSS (0) | 513 (+18) | ✓ · ✓ · — |
| lab/CommentThread | 296.2 kB (+73 B) · 2.4 kB CSS (0) | — | — · — · — |
1 more component
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/Comments | 301.8 kB (+68 B) · 2.5 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 6.75 MB packed (+742 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 19 rows, core 24 rows; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and five fixes are needed either way.
This head no longer only adds tests: it moves a caller's role="alert" from Banner's frame onto its message element, and it rewrites Banner FR2, FR8, DEC-2 and DEP-0007 and spec:AST-086 FR3 to match. Those record changes alter current requirements, so an engineering owner needs to approve or reject them, including the space every Banner with a description now renders between title and description. An engineering owner records approval by commenting /approve-spec 37ab0b0d3d4d2855a0df2d400ca36e04b8df8078, and the author can do this as an engineering owner.
Blocking:
- Callers moving off DEP-0007's status-derived roles are no longer told that
role="status"keeps a persistent mirror, and its replacement now saysrole="alert"lands on the message element (Banner.spec.md:60,:63); that needs an explicit owner decision for DEP-0007, cited in the description. Found by: deprecation rule - The title and description still describe a test-only change ("does not … change runtime behavior", six recorded failures, one record touched), while this head changes
Banner.tsx, ships a[fix]changeset, edits two records and records no failures, so please retitle, rewrite the body for this head and rerun the writing rubric over both records. - The changeset says what "a screen reader" reads and that title and description now "read as two parts", but the evidence is DOM and accessibility tree only and Chromium's tree already exposed them as two text nodes, so please describe the role placement instead.
- The proposed Banner record contradicts itself on
role="status": DEP-0007'sdownstreamandwarningrows and the code still offer it, while the docs, FR8 and thereplacementrow drop it, so keep it everywhere or remove it everywhere. - A caller's
aria-label, and any otheraria-*passed withrole="alert", stays on the frame, so the alert loses its name (Banner.tsx:665); please move those attributes with the role and add a test.
[Automated review]
| className, | ||
| style, | ||
| )} | ||
| role={isUrgentAlert ? undefined : role} |
There was a problem hiding this comment.
Only role moves to the message element. aria-label, aria-labelledby, aria-atomic and other attributes passed with role="alert" stay here in rest, on a div that now has no role. In Chromium, <Banner role="alert" aria-label="Upload error" …> exposes an alert named "Upload error" before this change and an unnamed alert after it. Please route the alert's naming and live-region attributes to the message element too, and add a test.
| {/* A flex container renders no whitespace-only text, so this space | ||
| only separates the title and the description in the text that | ||
| assistive technology reads. */} |
There was a problem hiding this comment.
Non-blocking: Chromium's accessibility tree has no node for this space and already exposes the title and description as two text nodes without it, so the space changes DOM text only. Suggested:
{/* A flex container does not render whitespace-only text. This space
separates the title and the description in the DOM text only. */}| | package | `@astryxdesign/core` | | ||
| | surface | Default ARIA role of `Banner`: `role="alert"` for `warning` and `error`, `role="status"` for `info` and `success`, derived from `status` when the caller passes no `role` | | ||
| | old contract | Visual `status` selects the live-region role of the Banner root | | ||
| | replacement | A caller that announces an async outcome calls `useAnnounce` from the transition that produced it. An urgent message passes `role="alert"`, which Banner places on its message element (FR8). Inside a mounted live container, `spec:AST-086` FR4 applies instead. | |
There was a problem hiding this comment.
This changes DEP-0007's replacement (and its migration row on line 63). Callers moving off the status-derived roles are no longer told that role="status" keeps a persistent mirror. That needs an explicit owner decision for DEP-0007, cited in the pull request description (a decision card, or the owner's quoted words with a time), or these rows restored. Found by: deprecation rule
| | warning | Consumer docs and the release notes name `DEP-0007` and the explicit `role` that keeps the released semantics. No runtime warning (`spec:AST-017` FR29) | | ||
| | migration | Non-mechanical: a caller that announces an async outcome calls `useAnnounce` from the transition that produced it; a caller with an urgent message passes `role="alert"`. Inside a mounted live container, `spec:AST-086` FR4 applies instead. | | ||
| | codemod | None: whether a Banner needs an announcement, and when, depends on the transition that renders it, which only the caller knows; adding the released role everywhere would restore the coupling this cleanup removes | | ||
| | downstream | Maintained docs teach `useAnnounce` for async outcomes and explicit `role` for persistent mirrors. Inside a mounted live container, `spec:AST-086` FR4 applies instead. | |
There was a problem hiding this comment.
This row still says maintained docs teach an explicit role for persistent mirrors, and warning (line 62) still promises the explicit role that keeps the released semantics. But this pull request removes the role="status" advice from Banner.doc.mjs in all three locales, and the replacement row no longer offers it. Please keep role="status" in the docs and the replacement, or update these rows to say what replaces it.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Banner: `role="alert"` now covers the urgent message only. Banner places the role on the title and description instead of the whole banner, so a screen reader no longer reads the dismiss or expand control, its tooltip, a caller's action, or the supporting content as part of the alert, and the title and description read as two parts. Other roles still land on the banner frame. Use `role="alert"` only for an urgent message, and announce every other message with `useAnnounce`. |
There was a problem hiding this comment.
The evidence for this change is DOM and accessibility tree, which cannot show what a screen reader reads. Chromium's tree also exposed the title and description as two separate text nodes before this change; the new space changes DOM text only. Suggested: "Banner: role=\"alert\" now sits on the title and description only, so the dismiss and expand controls, their tooltips, a caller's action and the supporting content are outside the alert region."
…e separator renders only in the alert; DEP-0007 rows drop the persistent-mirror role
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and three fixes are needed either way.
This head moves a caller's role="alert", and the aria-* passed with it, from Banner's frame onto its message element, and rewrites Banner FR2, FR8, DEC-2, the DEP-0007 rows and spec:AST-086 FR3 to match. Those record changes alter current requirements, so an engineering owner needs to approve or reject them by commenting /approve-spec 9c58b0b838816feb6c94d906c12cadbf1c81f8df; the author can do this as an engineering owner. The earlier DEP-0007, description, changeset and aria-label findings are resolved.
Blocking:
- Miss:
spec:AST-086FR2 still says an element that mounts together with its text "MUST NOT carry a live role", which contradicts the new FR3 exception for the urgent Banner alert, so please give FR2 the same exception, update its Current-state impact line, and limit Banner's "A Banner mounted together with its message is not a reliable announcement" to other messages. - Proposed Banner FR2 keeps "supported DOM props" on the frame with
role="alert"as the only exception, whileBanner.tsxnow moves everyaria-*prop to the message element, so please name thearia-*attributes in FR2, FR8 and the FR8 alert-state verification row. - The description's User impact says a screen-reader user "hears" a run-on string and that the title and description "run together with no break", but Chromium's accessibility tree already exposes them as two text nodes on the base and the new space changes DOM text only, so please describe the DOM and accessibility-tree difference instead of speech (Miss: the record's "read as two parts" makes the same claim).
[Automated review]
| - **FR3 — Live roles only on persistent containers.** A component MAY own a | ||
| live role only on an element that stays mounted while its content changes. | ||
| It MUST NOT mount that element already holding the text to announce. | ||
| It MUST NOT mount that element already holding the text to announce, except |
There was a problem hiding this comment.
Miss: FR2 just above still says an element that mounts together with its text "MUST NOT carry a live role or aria-live", and the Current-state impact says Banner FR8 already matches FR2. Please give FR2 the same urgent-Banner exception and update that line, so the two rules agree.
| | ID | Invariant | Basis | Contract state | | ||
| | --- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------ | | ||
| | FR1 | The current render places `banner` on the colored status surface, which is Banner's primary painted surface and reflects `container` and `status`. | Current source, public docs, and tests | Current behavior | | ||
| | FR2 | The Banner frame receives the public ref, role, supported DOM props, `xstyle`, `className`, and `style`; it also paints the selected `boxShadow`. The exception is `role="alert"`, which lands on the message element (FR8). | Current source and tests | Current behavior | |
There was a problem hiding this comment.
Banner.tsx now moves every aria-* prop passed with role="alert" to the message element, but this row keeps supported DOM props on the frame with only role="alert" excepted. Suggested: The exception is role="alert" and the aria-* attributes passed with it, which land on the message element (FR8). FR8 and the FR8 alert-state row need the same words.
| genuinely urgent content that should interrupt current speech; it is not used on | ||
| a Banner added inside a mounted live container. | ||
| announcement urgency. An urgent Banner's message element carries `role="alert"`; | ||
| its exposed text is the title and the description, read as two parts. Controls, |
There was a problem hiding this comment.
Miss: "read as two parts" claims speech. Chromium's accessibility tree already exposes the title and description as two text nodes without the space, and DOM and accessibility-tree evidence cannot show what is spoken. Suggested: "its exposed text is the title and the description."
…a-* attributes travel with role=alert; DOM wording
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and two fixes are needed either way.
This head moves a caller's role="alert", and the aria-* passed with it, from Banner's frame onto its message element, and rewrites Banner FR2, FR8, DEC-2, the DEP-0007 rows and spec:AST-086 FR2 and FR3 to match. Those record changes alter current requirements, so an engineering owner needs to approve or reject them by commenting /approve-spec followed by this pull request's full head SHA; the author can do this as an engineering owner. The three findings from the last review (AST-086 FR2, the aria-* wording in FR2, and the speech claim) are resolved.
Blocking:
- Miss: Callers moving off Banner's status-derived roles are no longer told that
role="status"keeps a persistent status mirror (DEP-0007replacement,warning,migrationanddownstreamrows), and that change needs an explicit owner decision for DEP-0007, so please name the owner and quote their words with the time in the description, since "Owner direction (Banner FR8 and DEP-0007, Nov 5)" gives neither. Found by: deprecation rule. - Miss: The
[fix]changeset names the old and new placement but not the accessibility target it serves, which AST-017 FR53 requires, so please add it, for example "so an urgent alert holds only its message (component:BannerFR8; WCAG 2.2 4.1.3 Status Messages)".
Non-blocking: 466 of the 469 changed lines in Banner.doc.mjs are a Prettier reflow around three guidance edits; splitting the reflow out would make the guidance change reviewable.
[Automated review]
| | package | `@astryxdesign/core` | | ||
| | surface | Default ARIA role of `Banner`: `role="alert"` for `warning` and `error`, `role="status"` for `info` and `success`, derived from `status` when the caller passes no `role` | | ||
| | old contract | Visual `status` selects the live-region role of the Banner root | | ||
| | replacement | A caller that announces an async outcome calls `useAnnounce` from the transition that produced it. An urgent message passes `role="alert"`, which Banner places on its message element (FR8). Inside a mounted live container, `spec:AST-086` FR4 applies instead. | |
There was a problem hiding this comment.
Miss: this row, with warning, migration and downstream (lines 62, 63 and 65), stops offering role="status" as the persistent-mirror replacement for callers moving off the status-derived roles. A change to a DEP entry needs an explicit owner decision that names it: who decided, their quoted words and when. The description's "Owner direction (Banner FR8 and DEP-0007, Nov 5)" names no owner, quotes no words and gives a date only, and /approve-spec does not stand in for it. Found by: deprecation rule.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Banner: `role="alert"` now sits on the title and description only, not on the whole banner, so the dismiss and expand controls, their tooltips, a caller's action, and the supporting content are outside the alert. ARIA attributes passed with `role="alert"`, such as `aria-label`, move with it. Other roles still land on the banner frame. Use `role="alert"` only for an urgent message, and announce every other message with `useAnnounce`. |
There was a problem hiding this comment.
Miss: AST-017 FR53, which makes this accessibility change a patch [fix], says the Changeset names the old and new behavior and the accessibility target it serves. This line names the placement change but no target. Suggest ending the first sentence with "so an urgent alert holds only its message (component:Banner FR8; WCAG 2.2 4.1.3 Status Messages)".
|
/approve-spec 5d61b72 |
There was a problem hiding this comment.
Changes requested: the spec changes are approved for this head, and three fixes remain.
This head moves a caller's role="alert", and the aria-* passed with it, from Banner's frame onto its title-and-description element. The alert states render the same pixels as before, and the new tests and the Chromium alert binding pass.
Blocking:
- Miss: Callers moving off Banner's status-derived roles are no longer told that
role="status"keeps a persistent status mirror (DEP-0007replacement,warning,migrationanddownstreamrows), and that change needs an explicit owner decision for DEP-0007 beyond the spec approval, so please name the owner and quote their words with the time in the description, since "Owner direction (Banner FR8 and DEP-0007, Nov 5)" gives neither. Found by: deprecation rule. - The
[fix]changeset names the old and new placement but not the accessibility target it serves, which AST-017 FR53 requires, so please add it, for example "so an urgent alert holds only its message (component:BannerFR8; WCAG 2.2 4.1.3 Status Messages)". - Miss: The
BannerStatusMapJSDoc inpackages/core/src/Banner/index.tsstill tells builders to opt intorole="status", which the updated FR8 and DEP-0007downstreamrow no longer teach, so please align it with the newBanner.doc.mjsguidance.
One non-blocking wording suggestion is inline.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Banner: `role="alert"` now sits on the title and description only, not on the whole banner, so the dismiss and expand controls, their tooltips, a caller's action, and the supporting content are outside the alert. ARIA attributes passed with `role="alert"`, such as `aria-label`, move with it. Other roles still land on the banner frame. Use `role="alert"` only for an urgent message, and announce every other message with `useAnnounce`. No visual change: the banner renders the same pixels as before. |
There was a problem hiding this comment.
AST-017 FR53, which makes this accessibility change a patch [fix], says the Changeset names the old and new behavior and the accessibility target it serves. This line names the placement change and "No visual change", but still no target. Suggest ending the first sentence with "so an urgent alert holds only its message (component:Banner FR8; WCAG 2.2 4.1.3 Status Messages)".
…tusMap JSDoc matches the alert guidance The changeset says the move serves component:Banner FR8 and WCAG 2.2 4.1.3 Status Messages. BannerStatusMap no longer tells builders to opt into role="status"; it points to useAnnounce and keeps role="alert" for urgent messages.
There was a problem hiding this comment.
Changes requested: one record fix remains. The spec changes are approved for this head, and the three earlier fixes are in.
role="alert", and the aria-* passed with it, now land on Banner's title-and-description element, so an urgent alert holds only its message. The new unit tests fail on main and pass here, the Chromium alert binding passes all seven states, and the alert renders the same pixels as before.
Blocking:
- Miss: AST-086 FR2's first sentence still says the owner announces through the shared channel whenever a message element mounts with its text, excepting only FR4, FR10, FR11 and FR14, which contradicts Banner FR8 ("A Banner with
role="alert"is not also announced throughuseAnnounce"), so please add the urgent Banner'srole="alert"message (FR3) to that exception list (docs/specs/AST-086-status-announcements/spec.md:80-83).
One non-blocking wording suggestion is inline.
[Automated review]
| shows a message mounts, unmounts, or is replaced together with its text, the | ||
| owner announces through the shared announcement channel, except as FR4, FR10, | ||
| FR11, and FR14 provide. The new element |
There was a problem hiding this comment.
Miss: this sentence still requires the owner to announce through the shared channel when the element mounts together with its text, and its exceptions (FR4, FR10, FR11, FR14) do not cover the urgent Banner that the next sentence and FR3 now allow. Banner FR8 says a Banner with role="alert" is not also announced through useAnnounce, and FR1 forbids doing both, so for an urgent Banner that appears with its text the two records disagree. Suggested:
owner announces through the shared announcement channel, except as FR3 (an
urgent Banner's `role="alert"` message), FR4, FR10, FR11, and FR14 provide.
| * pass an explicit role when a persistent semantic mirror is appropriate. | ||
| * announce async outcomes from their transition handler with `useAnnounce`. | ||
| * Pass `role="alert"` only for an urgent message: Banner places it on the | ||
| * title and description, so controls and supporting content are not read. |
There was a problem hiding this comment.
Non-blocking: the controls and supporting content are still read when the person browses; only the alert leaves them out. Banner.doc.mjs already says "not read as part of the alert". Suggested:
* title and description, so controls and supporting content are not read as
* part of the alert.…gent Banner alert FR2 named FR4, FR10, FR11 and FR14 as the only exceptions to announcing through the shared channel, which contradicted FR3 and Banner FR8 for an urgent Banner. The Banner JSDoc now says controls are not read as part of the alert.
|
/approve-spec 7a157c5 |
There was a problem hiding this comment.
Approved pending CI: the required checks are still running on this head.
role="alert" and the aria-* passed with it now sit on Banner's title and description, so an urgent alert leaves out the controls, their tooltips and the supporting content, with no visual change. The component:Banner and spec:AST-086 record changes are approved for this head, and AST-086 FR2 now agrees with Banner FR8. The new placement tests fail before the fix and pass with it, the seven urgent alert states pass in Chromium, and the alert renders are pixel-identical to the base.
[Automated review]
No visual change
This pull request changes alerting only. Nothing about how a Banner looks changes: no element, style or layout changes.
role="alert"moves from the frame to the existing title-and-description element, and the space that separates the title and the description exists only in the alert's text (a flex column renders no whitespace-only text).Checked in real Chromium at head
5d61b722(main merged) against main4ceed673, each from its own Storybook build: all 20Bannerstories, at 1280 px and 390 px, light and dark, left-to-right and right-to-left, each also re-rendered withrole="alert"passed (80 of the runs). All 240 full-page screenshots are byte-identical between this head and main.What changes is only what an urgent alert contains (accessible text of the
role="alert"element, same stories,role="alert"passed):A Banner without
rolerenders no live role on either side (0 of 20 stories), so a non-urgent message is announced once, by the caller'suseAnnounce. An urgent Banner carries onerole="alert"and is not also announced throughuseAnnounce(Banner FR8), so no message is announced twice.User impact
An urgent Banner (
role="alert") put its whole frame in the alert region, so the region's text included control text: "Session expires soonDismiss", "Upload failedRetry", or the "Collapse" tooltip in the middle of the message. The title and the description were adjacent with no separator in the DOM text (the accessibility tree already exposes them as two text nodes). After this change, an urgent Banner's alert region holds the authored message only: the title and the description, with a space between them in the DOM text. The dismiss and expand controls, their tooltips, a caller'sendContentaction, and the supporting content area sit outside it. Every other Banner message is announced through the standarduseAnnouncemodule, so one owner announces each message.Problem and solution fit
roleto its outer frame, so the alert region held the whole banner, controls and closed tooltips included. The title and description are adjacent block elements with no separator in the region's text.alertrole: the region carries the complete authored message. The design owner's direction is to allowrole="alert"for urgent messages and to use the standard announce modules for everything else, so a message is never announced twice.Fix: when the caller passes
role="alert", Banner places it on the message element (the title and the description) and not on the frame. ARIA attributes passed with it, such asaria-label, move with it, so the alert keeps its name. Inside an urgent alert only, a space separates the title and the description in the alert's text; a flex container renders no whitespace-only text, so nothing visual changes. Any other role and its attributes still land on the frame. No new prop, and no default changes: a Banner withoutrolerenders no live role, as before.Expected behavior and authority
Owner decision for Banner FR8 and DEP-0007: cixzhang (design and engineering owner), 2026-11-05 15:10 UTC: "6779 I'd out of date a bit. We could allow a role alert for urgent ones but keep in mind we have standard announce modules to avoid issues". So
role="alert"stays for urgent messages, and every other message uses the standard announce modules. This is why DEP-0007's replacement, migration, warning and downstream rows drop the persistent-mirrorrole="status"advice, leaving one announcement path:useAnnounce, orrole="alert"for an urgent message.component:BannerFR8, FR2, the Accessibility contract, DEC-2 and DEP-0007, updated in this PR: an urgent message MAY carryrole="alert", which lands on the message element (title and description only). Other announcements go throughuseAnnounceatspec:AST-086FR5's urgency, and a Banner withrole="alert"is not also announced throughuseAnnounce.spec:AST-086FR2 and FR3 gain the urgent-Banner exception, and its Current-state line for Banner FR8 says so. Banner FR2, FR8 and the FR8 alert-state row name thearia-*attributes that travel withrole="alert".The Banner alert binding (
STATUS_MESSAGE_PATTERN, AST-020/AST-021) over seven explicit urgent states. AST-009 is unchanged: no claim about spoken wording or timing.Smallest restoration
Banner.tsx:role="alert"and its ARIA attributes move from the frame to the message element, and inside the alert a separator goes between the title and the description.Banner.spec.mdand AST-086 FR3: the record changes above.Banner.doc.mjs: the guidance drops the persistent-mirrorrole="status"advice and says whererole="alert"lands (English, Chinese, dense).Banner.test.tsxcases for where the role and its ARIA attributes land, and the alert's exact text.component:BannerFR8; WCAG 2.2 4.1.3 Status Messages).BannerStatusMapJSDoc: the same guidance asBanner.doc.mjs(announce withuseAnnounce;role="alert"only for an urgent message).Evidence
The before column is the six failures this binding recorded against the old placement. After: real Chromium,
Alert.a11y.chromium.spec.ts, 8 of 8 pass with no known failures. Role, assertive channel and focus preservation hold across a message update.Scope
Owner decisions
Testing
Banner.test.tsx"puts an urgent role="alert" on the message" fails on the record-and-test commit (the role is on the frame) and passes with the fix.vitest run packages/core/src/Banner: 74 pass.Alert.a11y.test.tsx: 8 pass.Alert.a11y.chromium.spec.tsin real Chromium against this head's Storybook: 8 pass.pnpm -F @astryxdesign/core typecheck, eslint, Prettier,pnpm check:knowledge,pnpm check:changesets.Writing rubric results
R1 narration: none; the FR8, contract and DEC-2 text states the system in the present tense.
R2 research: none in the record.
R3 evidence: verification cells cite the binding and tests, not a pull request.
R4 rejected alternatives: DEC-2 has two, each one line ("a live role on the whole frame"; "deriving alert urgency from warning or error"). AST-086 (one FR3 sentence) has none added.
R5 change references: none.
R6 open questions: none in the record; the content-area question is in this description for the owner.