Skip to content

♿️(frontend) limit share modal opening announcement for screen readers#2452

Open
Ovgodd wants to merge 1 commit into
mainfrom
fix/a11y-2334-share-modal-access-names
Open

♿️(frontend) limit share modal opening announcement for screen readers#2452
Ovgodd wants to merge 1 commit into
mainfrom
fix/a11y-2334-share-modal-access-names

Conversation

@Ovgodd

@Ovgodd Ovgodd commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Limit the screen reader announcement when opening the share modal without the search input.

Proposal

  • Autofocus the close button when the search input is hidden

@Ovgodd Ovgodd requested a review from AntoLC June 22, 2026 14:03
@Ovgodd Ovgodd self-assigned this Jun 22, 2026
@Ovgodd Ovgodd added bug Something isn't working accessibility triage labels Jun 22, 2026
Autofocus close and hide modal body from SR when search input is hidden.
@Ovgodd Ovgodd force-pushed the fix/a11y-2334-share-modal-access-names branch from 065c3b1 to 49c6f8e Compare June 22, 2026 14:03
@Ovgodd Ovgodd marked this pull request as ready for review June 22, 2026 14:05
@Ovgodd Ovgodd moved this from Backlog to In review in LaSuite Docs A11y Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Size Change: +1 B (0%)

Total Size: 4.33 MB

📦 View Changed
Filename Size Change
apps/impress/out/_next/static/b54acd78/_buildManifest.js 0 B -675 B (removed) 🏆
apps/impress/out/_next/static/f369a067/_buildManifest.js 676 B +676 B (new file) 🆕

compressed-size-action

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

DocShareModal introduces a DEBOUNCE_MS constant (300 ms) and an isContentAccessible state initialized from canShare. A useEffect watching canShare sets isContentAccessible to false immediately and schedules it back to true after DEBOUNCE_MS when canShare is false, with timeout cleanup on unmount. The modal close button gains autoFocus={!canShare}, and the main content wrapper sets aria-hidden based on isContentAccessible. CHANGELOG.md records the new accessibility behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • AntoLC
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: limiting share modal opening announcement for screen readers, which directly corresponds to the file changes and PR objectives.
Description check ✅ Passed The description is related to the changeset, explaining the purpose (limiting screen reader announcements) and the proposed solution (autofocusing the close button).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/a11y-2334-share-modal-access-names

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-share/components/DocShareModal.tsx`:
- Around line 43-44: The constant DEBOUNCE_MS is being used for two unrelated
purposes: query filtering and accessibility re-exposure delay. Create two
separate constants instead - one specifically for search query debouncing and
another for the accessibility re-exposure delay timing. This decouples these
independent concerns so each can be tuned separately without affecting the
other. Find where DEBOUNCE_MS is used at the query filtering location (around
line 125) and the accessibility re-exposure location (around line 176), then
replace the appropriate usages with their respective new constants.
- Around line 167-180: The useEffect hook in DocShareModal only handles the case
when `canShare` is false by scheduling `isContentAccessible` to true, but it
does not reset `isContentAccessible` to false when `canShare` transitions from
false to true. To fix this, add a branch in the useEffect that immediately sets
`isContentAccessible` to false when `canShare` becomes true, ensuring the
content is removed from the accessibility tree during the opening announcement
for every transition of the `canShare` state.
🪄 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: 06e60d43-e900-4cc3-9140-39504c2bd9d2

📥 Commits

Reviewing files that changed from the base of the PR and between 87fbcba and 49c6f8e.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareModal.tsx

Comment on lines +43 to +44
const DEBOUNCE_MS = 300;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Decouple search debounce timing from accessibility timing.

DEBOUNCE_MS currently drives both query filtering (Line 125) and accessibility re-exposure delay (Line 176). This couples unrelated UX knobs and makes future tuning risky.

Suggested refactor
-const DEBOUNCE_MS = 300;
+const SEARCH_DEBOUNCE_MS = 300;
+const A11Y_CONTENT_REVEAL_DELAY_MS = 300;
...
-  }, DEBOUNCE_MS);
+  }, SEARCH_DEBOUNCE_MS);
...
-    }, DEBOUNCE_MS);
+    }, A11Y_CONTENT_REVEAL_DELAY_MS);

Also applies to: 125-125, 176-176

🤖 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-share/components/DocShareModal.tsx`
around lines 43 - 44, The constant DEBOUNCE_MS is being used for two unrelated
purposes: query filtering and accessibility re-exposure delay. Create two
separate constants instead - one specifically for search query debouncing and
another for the accessibility re-exposure delay timing. This decouples these
independent concerns so each can be tuned separately without affecting the
other. Find where DEBOUNCE_MS is used at the query filtering location (around
line 125) and the accessibility re-exposure location (around line 176), then
replace the appropriate usages with their respective new constants.

Comment on lines +167 to +180
// When the search input is hidden, keep the modal content out of the
// accessibility tree during the opening announcement, then restore it.
useEffect(() => {
if (canShare) {
return;
}

const id = window.setTimeout(() => {
setIsContentAccessible(true);
}, DEBOUNCE_MS);

return () => window.clearTimeout(id);
}, [canShare]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Ensure isContentAccessible is reset on every canShare transition.

Line 169 only handles the canShare === false branch by scheduling true, but it never forces false when canShare flips from true to false after mount. In that transition, Line 227 can keep content exposed to assistive tech, so the announcement-limiting behavior is skipped.

Suggested fix
   useEffect(() => {
-    if (canShare) {
-      return;
-    }
+    setIsContentAccessible(canShare);
+    if (canShare) return;
 
     const id = window.setTimeout(() => {
       setIsContentAccessible(true);
     }, DEBOUNCE_MS);
 
     return () => window.clearTimeout(id);
   }, [canShare]);

Also applies to: 227-227

🤖 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-share/components/DocShareModal.tsx`
around lines 167 - 180, The useEffect hook in DocShareModal only handles the
case when `canShare` is false by scheduling `isContentAccessible` to true, but
it does not reset `isContentAccessible` to false when `canShare` transitions
from false to true. To fix this, add a branch in the useEffect that immediately
sets `isContentAccessible` to false when `canShare` becomes true, ensuring the
content is removed from the accessibility tree during the opening announcement
for every transition of the `canShare` state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility bug Something isn't working triage

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Share modal: spurious restitution of accessible names unrelated to the dialog window

1 participant