♿️(frontend) announce search loading state for screen readers#2526
♿️(frontend) announce search loading state for screen readers#2526Ovgodd wants to merge 2 commits into
Conversation
Add live region announcement when document search is in progress.
b1c1e64 to
0b3207c
Compare
Walkthrough
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx`:
- Around line 118-122: Update the loading announcement effect in
DocSearchContent so it fires only when loading transitions from false to true,
rather than on every search change while loading remains active. Track the
previous loading state within the component, preserve the existing
search/isSearchNotMandatory eligibility check, and avoid re-announcing until
loading becomes inactive and starts again.
- Around line 118-122: Update the useEffect in DocSearchContent so its cleanup
clears the polite announcer via clearAnnouncer('polite') when the component
unmounts or the effect reruns. Preserve the existing conditional loading
announcement behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5738afb7-21e3-4715-a0e7-aa5e735218d5
📒 Files selected for processing (2)
CHANGELOG.mdsrc/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx
|
Size Change: 0 B Total Size: 4.37 MB 📦 View Changed
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx (1)
120-129: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClear the polite announcement on cleanup.
As flagged in a previous review, unmounting the modal while loading can leave the "Loading documents..." message queued in the global live region. Add a cleanup function to this effect to clear the polite announcer so that obsolete loading announcements do not persist. (Ensure
clearAnnounceris imported from@react-aria/live-announcer).🧹 Proposed fix
useEffect(() => { if ( loading && !prevLoadingRef.current && (search || isSearchNotMandatory) ) { announce(t('Loading documents...'), 'polite'); } prevLoadingRef.current = loading; + + return () => clearAnnouncer('polite'); }, [loading, search, isSearchNotMandatory]);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx` around lines 120 - 129, Update the loading announcement useEffect in DocSearchContent to return a cleanup function that calls clearAnnouncer with the polite channel, and import clearAnnouncer from `@react-aria/live-announcer`. Preserve the existing loading detection and prevLoadingRef update behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In
`@src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx`:
- Around line 120-129: Update the loading announcement useEffect in
DocSearchContent to return a cleanup function that calls clearAnnouncer with the
polite channel, and import clearAnnouncer from `@react-aria/live-announcer`.
Preserve the existing loading detection and prevLoadingRef update behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8664efa4-cff0-4677-bbe2-555b420e1f8d
📒 Files selected for processing (1)
src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchContent.tsx
Purpose
Fix an accessibility issue where the "Loading documents..." message during document search is not conveyed by screen readers. Blind users receive no feedback that their input was registered while results are loading (RGAA criterion 7.1).
Proposal
@react-aria/live-announcerwhen search loading starts inDocSearchContent