Skip to content

docs(changeset): shared announcer regions can match an app's getByRole('status') queries - #8354

Merged
cixzhang merged 2 commits into
mainfrom
docs/announcer-role-query-changeset
Oct 25, 2026
Merged

cixzhang merged 2 commits into
mainfrom
docs/announcer-role-query-changeset

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

User impact

A product engineer whose tests find their own status or alert with getByRole('status') / getByRole('alert') may see those queries start matching a different element after #8294: EmptyState now announces through the page's shared announcer regions, a visually hidden role="status" / role="alert" pair Astryx mounts once on document.body (spec:AST-086 FR2). This changeset tells them why and how to scope the query, so the upgrade note is in the CHANGELOG.

Change

One [docs] patch changeset for @astryxdesign/core. No code, record, or behavior change.

Testing

  • node scripts/check-changesets.mjs passes.
  • Prettier clean.

…e('status') queries

EmptyState now announces through the page's shared announcer regions
(spec:AST-086 FR2), a visually hidden role="status" / role="alert" pair on
document.body, so a test's getByRole('status') or getByRole('alert') can
match one of them. The changeset tells callers to scope such queries or
skip elements carrying data-astryx-live-region.
@vercel

vercel Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 25, 2026 4:20am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 25, 2026, 4:38 AM UTC

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release note matches what ships: on this head, an EmptyState that appears after load creates the shared, visually hidden role="status" / role="alert" regions on document.body, and within(container) scopes getByRole back to the app's own elements. Approval waits on one decision, because the note also tells consumers to skip elements carrying data-astryx-live-region, an internal attribute that no current spec names as a supported surface (spec:AST-086 keeps the announcement channel's internals replaceable, and spec:AST-017 FR3 leaves undocumented markup outside compatibility). An engineering owner needs to settle whether consumer tests may rely on that attribute, identifying or adding the governing spec claim, and record the decision by commenting /approve-spec <full head SHA> on this pull request; the author can do this if they are an engineering owner.

[Automated review]

Comment thread .changeset/announcer-role-query.md Outdated
'@astryxdesign/core': patch
---

[docs] EmptyState now announces through the page's shared announcer regions, a visually hidden `role="status"` (polite) and `role="alert"` (assertive) pair that Astryx mounts once on `document.body`. In tests, a query such as `getByRole('status')` or `getByRole('alert')` can therefore match one of these regions rather than your component. Scope the query to your component (`within(container)`), or skip elements carrying `data-astryx-live-region`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recommends filtering on data-astryx-live-region, a module-private constant in packages/core/src/hooks/useAnnounce.ts that no current spec or consumer doc names as something consumer tests may rely on, so an engineering owner needs to decide whether it is a supported surface. On this head, within(container) alone already returns the app's own status and alert.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 25, 2026
…eries

data-astryx-live-region is an internal attribute of the shared announcer
(spec:AST-086 keeps the channel's internals replaceable), so the note no
longer suggests consumer tests skip elements by it.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This release note is accurate and needs no changes: on this revision, an EmptyState that appears after load creates the shared, visually hidden role="status" / role="alert" regions on document.body, unscoped getByRole queries also find them, and within(container) returns the app's own elements. Dropping the data-astryx-live-region suggestion settles the earlier open point, since the note no longer asks consumer tests to rely on internal markup. Two optional wording tweaks would help readers who arrive from a failing test:

  • With the app's own element present, Testing Library reports Found multiple elements with the role "status" (or "alert"), and the error persists into later tests in the same file because the regions stay on document.body.
  • Text queries meet the same regions: with a title-only EmptyState, screen.getByText('<title>') also matches the polite region's copy of the title, and within(container) fixes that too.

[Automated review]

@cixzhang
cixzhang merged commit 382d312 into main Oct 25, 2026
62 checks passed
@cixzhang
cixzhang deleted the docs/announcer-role-query-changeset branch October 25, 2026 05:44

This branch was successfully deployed

1 active deployment
Preview — aa6ad824 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant