Repository navigation
fix(ChatComposerInput): announce the trigger menu's loading text through the shared channel - #7900
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. ChatComposer - 1 issue(s)
ChatComposerInput - 1 issue(s)
Visual Regression46 of 494 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 26 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Thanks for the fix: the loading row no longer carries role="status", and the trigger's loading text now reaches the shared polite channel once per search. Three changes are needed before this can merge:
- In
useTriggerMenu.tsx, derive the announcement flag from the same state that renders the row (includestate.activeTrigger !== null) and clear the debounce timer in the popover'sonHide, because a click outside the menu within the debounce window currently announces “Searching…” with no menu open and then leaves the next search silent. - Resolve the default loading text through the i18n catalog (one
en.jsonkey shared by the row and the announcement) instead of the'Searching…'literal, asdocs/architecture/internationalization.mdINV1a requires for live-region announcements. - Add the AST-009 FR4 classification to the description, with the NVDA + Chrome (Windows) and VoiceOver + Safari (macOS) rows marked pending and a short reproduction scenario, since AST-009 FR17 needs those and a release-block record before merge.
[Automated review]
| // loading row goes away, so the next search is a new occasion. | ||
| const announce = useAnnounce(); | ||
| const hasAnnouncedLoadingRef = useRef(false); | ||
| const isLoadingRowShown = state.isLoading && !state.isHidden; |
There was a problem hiding this comment.
This flag is looser than the row's own render condition: renderMenu returns nothing while activeTrigger is null (line 889). When the popover's onHide runs inside the debounce window, the timer from line 606 still calls doSearch, which sets isLoading: true with activeTrigger: null, so this effect announces “Searching…” with no menu open; the stale result is then discarded, isLoading stays true, and the next search is not announced. Adding state.activeTrigger !== null && here removes both symptoms with the existing tests still passing, and clearing searchTimeoutRef in onHide fixes the stale timer itself. A regression test that dismisses within debounceMs and then starts a new search would lock it in.
| const announce = useAnnounce(); | ||
| const hasAnnouncedLoadingRef = useRef(false); | ||
| const isLoadingRowShown = state.isLoading && !state.isHidden; | ||
| const loadingAnnouncement = state.activeTrigger?.loadingText ?? 'Searching…'; |
There was a problem hiding this comment.
This adds a live-region announcement whose default is a literal; docs/architecture/internationalization.md INV1a requires Astryx-owned announcements to come from an en.json key through the translator. Because AST-086 FR7 ties the spoken words to the row's default at line 898, one catalog key resolved once and used for both satisfies both rules, and translations may omit the key and fall back to English (INV6).
…ugh the shared channel
… stop announcing for a dismissed menu
1cddc53 to
aa86ad0
Compare
|
All three addressed in aa86ad0: the announcement flag now mirrors the row's render condition (active trigger, not hidden); |
There was a problem hiding this comment.
Thanks for the update: the dismissal path, the catalog-backed default and the AST-009 classification all check out on this revision, and the new tests fail on main and pass here. One fix is still needed: a synchronous source such as createStaticSource (every trigger story except Async Search) still enters the loading state on each keystroke (useTriggerMenu.tsx:590), so the new effect writes “Searching…” to the polite channel after every key while the results are already listed. Applying a synchronous result directly, so that only a pending search shows the loading row and announces, plus a createStaticSource test that expects no announcement, would fix it. AST-009 FR17 also needs the durable release-block record to exist before merge, with only the pending screen-reader receipts waiting for the stable release; AST-009's entry for #6950 shows its shape.
[Automated review]
| return; | ||
| } | ||
| hasAnnouncedLoadingRef.current = true; | ||
| announce(loadingText, 'polite'); |
There was a problem hiding this comment.
With a synchronous source (createStaticSource), doSearch still sets isLoading: true (line 590) before applying the array result a microtask later, so every keystroke turns isLoadingRowShown on and off and this call writes “Searching…” to the polite region after each key while the results are already listed (AST-086 FR7: “The announced words match the shown words”). Keeping a synchronous result out of the loading state, so only a pending search shows the row and announces, plus a createStaticSource test that expects no announcement, would fix it.
## Exact decision needed
Whether merge or stable release may wait on real assistive-technology (NVDA, VoiceOver) evidence that contributors cannot produce.
## Existing authority searched
- `spec:AST-009` (current): FR4/FR8/FR17–FR19 required an explicit trigger classification, a named real-AT matrix, a scenario, and a durable release-block record, and blocked the first stable release until real-AT receipts passed or an owner exception applied.
- Linked records that restated the block or required screen-reader checks: `spec:AST-001` (browser evidence and FR7 row), `module:Table/useTableRowStatus` AR6, `module:Table/useTableColumnResize` verification, `spec:AST-056` (browser evidence line), `spec:AST-021` (release boundary phrase), `spec:AST-086` (FR6 real-AT row and platform line), `component:FieldStatus` AR5 and its verification row, `spec:AST-020` FR6 ("real-AT contract").
- Open PRs that add release-block sections to AST-009: #7732, #7275, #7272. Under this record those sections are no longer needed.
## Decision
- No requirement gates merge or release on evidence that cannot be produced (Intent, FR17, DEC-4).
- Merge and stable release need only the unit, DOM, accessibility-tree, axe, and real-browser evidence the owning records require (FR17).
- Announcements are proved by their routing: which element or channel carries them, their text, urgency, and update count per occasion (FR4, FR19).
- Real-AT observation is recommended follow-up when an outcome depends on AT behavior, may be tracked in a public issue, and holds no pull request or release (FR1–FR6, FR18).
- A change with an AT-dependent claim says so and names its lower-layer evidence; no matrix, scenario, or release record is needed to merge (FR8).
- Evidence-layer boundaries, the representative matrix, failure handling, and durable receipts stay, scoped to when a real-AT check runs.
- The exception process (old FR23–FR26) is removed because nothing remains to except.
## Rejected alternatives
- Holding stable releases until named real-AT receipts pass: fixes for known accessibility defects stall when no contributor can run the required pairings.
## Claim scope and non-goals
Only the evidence bar for merge and release, and the status of real-AT observation. Component accessibility requirements, evidence-layer boundaries, and focus/announcement behavior stay with their owners.
## Evidence and implementation relationship
Status-announcement conformance PRs (#7869, #7870, #7871, #7892, #7900, #7910) stall on the old real-AT release-block requirement because nobody in the review loop can run NVDA or VoiceOver. No implementation is included.
## Writing rubric results
- R1 narration: none; present-tense rules throughout. The two earlier holds are described as current follow-ups.
- R2 research in the record: none.
- R3 evidence naming a change: none; the earlier hold sections that named pull requests are replaced by the facts (story names and claims).
- R4 rejected alternatives over one line or outside a decision: one per decision, one line each.
- R5 pull request or issue references remaining: none in AST-009 or the edited lines.
- R6 ruled open questions still listing options: none.
## Scope
- [x] This PR contains specification records only.
- [x] It records observable behavior and preserves equivalent internal implementations.
- [x] Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
- [x] Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
- [x] It records one intentional durable decision, not a rescue for a separable tagalong.
- [x] The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
- [x] Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
- [x] Public text and artifacts contain no internal Meta context.
## Validation
- `pnpm check:knowledge`
- Prettier
- `git diff --check`
…loading A source that returns an array, such as createStaticSource, already has its results, so the trigger menu no longer enters the loading state for it and the loading announcement never fires while the results are listed (spec:AST-086 FR7). Async sources are unchanged.
There was a problem hiding this comment.
Thanks for the update: static sources such as createStaticSource now stay silent, an async search is announced once per search, and dismissing the menu announces nothing, all confirmed in the browser on this revision. One fix is still needed: with debounceMs={0}, a source whose promise is already settled (a cache hit, or an async search over local data) still writes “Searching…” to the polite region on every keystroke although the loading row never reaches the screen, which AST-086 FR7 rules out. Announcing on the next animation frame, and cancelling in the effect's cleanup when the row goes first, fixes it; please add a test with such a source that expects no announcement. The release-block record requested earlier is no longer needed, since AST-009 FR17 now treats real screen-reader checks as optional follow-up.
[Automated review]
| return; | ||
| } | ||
| hasAnnouncedLoadingRef.current = true; | ||
| announce(loadingText, 'polite'); |
There was a problem hiding this comment.
With debounceMs={0} and a source whose promise is already settled (a cache hit, or an async search over local data), this call runs before the results commit, which lands one microtask later, so “Searching…” reaches the polite region on every keystroke although no frame ever shows the row (AST-086 FR7). Scheduling the call with requestAnimationFrame and cancelling it in the effect's cleanup when the row goes first fixes it, together with a settled-source test under debounceMs={0} that expects no announcement.
…ainted The loading announcement now waits for the second animation frame, which runs after the first paint, and is cancelled when the row goes first. A search whose promise settles before then, such as a cache hit or an async search over local data, never shows the row and announces nothing (spec:AST-086 FR7).
|
The settled-source case is covered by a17768c, which was pushed to this branch after the last review ran: the announcement is scheduled two animation frames after the row mounts and cancelled when the row goes first, so a search that settles before a frame is painted announces nothing, and a test with such a source under |
There was a problem hiding this comment.
Thanks for the update: this revision addresses the earlier review points and looks ready to merge from this automated review. The loading row no longer carries a live role, the trigger's loading text reaches the shared polite channel once per pending search, and nothing is announced for static sources, already-settled searches or a dismissed menu, as the new tests and browser checks show. You may also want to refresh the description, which still lists three new tests and treats the NVDA and VoiceOver rows as a release requirement, while AST-009 FR17 now makes them optional follow-up.
[Automated review]
Fixes #7859
User impact
A screen reader user typing
@or/in a chat composer with an async trigger source gets no spoken cue that a search is running. The "Searching…" row is inserted as a newrole="status"element that already holds its text, and it is removed when results arrive. Screen readers commonly skip a live region that is born with its content, so the loading state is silent.Problem and solution fit
useTriggerMenurenders the loading row as<div role="status">, mounted only while a search is pending.spec:AST-086FR2 says a transient message announces through the shared channel, and FR6 says once per occasion.Fix: the loading row loses its live role and
useTriggerMenuannounces the trigger'sloadingTextthroughuseAnnounceonce per loading episode. Typing more characters while the same search is still pending does not repeat it, a StrictMode effect replay does not repeat it, and the next search after results arrive is a new occasion. The default text now comes from the catalog (@astryx.chatTriggerMenu.searching, one key shared by the row and the announcement,spec:AST-086FR7). The announcement follows the row's own render condition (an active trigger and not hidden), and dismissing the menu clears a search still waiting out its debounce, so a press outside the menu cannot announce "Searching…" with no menu open. The visible row andloadingTextare otherwise unchanged.Testing
ChatComposerInput.test.tsxgains three cases: no live role on the row, one announcement across keystrokes under StrictMode with a second one for the next search, and a customloadingText. All three fail without the source change.tsc --noEmitfor core, eslint and prettier clean.Assistive technology (spec:AST-009)
@trigger source, type@and a letter. Expected: the screen reader says the loading text once while results load, then reads the results as the highlighted option changes; typing more letters during the same search does not repeat it; the row itself is not read as a live region.Per FR17 the real-AT rows and the release-block record are needed before a stable release; I do not have these assistive technologies available, so a maintainer or another contributor with access would need to record them.