Skip to content

fix: add role=alert to write-mode warning banner for screen readers#151

Merged
Mananwebdev160408 merged 4 commits into
Mananwebdev160408:mainfrom
Nakshathra-2808:fix/write-mode-banner-role-alert
Jul 4, 2026
Merged

fix: add role=alert to write-mode warning banner for screen readers#151
Mananwebdev160408 merged 4 commits into
Mananwebdev160408:mainfrom
Nakshathra-2808:fix/write-mode-banner-role-alert

Conversation

@Nakshathra-2808

Copy link
Copy Markdown
Contributor

Problem

Fixes #141

The write-mode warning banner rendered when the --write flag is active had no ARIA live region. Screen readers silently ignored it, meaning visually impaired users had no way to know they were in a mode that allows INSERT, UPDATE, and DELETE operations on their database. This is both an accessibility violation and a safety concern, violating WCAG 2.1 Success Criterion 4.1.3 (Status Messages).

Root Cause

The warning banner <div> in App.tsx was missing three ARIA attributes:

  • No role="alert" — screen readers treated it as a plain container and never announced it
  • No aria-live="assertive" — no live region meant no automatic announcement on mount
  • No aria-atomic="true" — without this, screen readers may read the message in fragments

Additionally the decorative AlertTriangleIcon had no aria-hidden, causing it to be announced as an unlabelled graphic before the warning text.

Fix

  • Added role="alert" to the warning banner <div> — marks it as an important announcement
  • Added aria-live="assertive" — interrupts the screen reader immediately to announce the banner when it appears
  • Added aria-atomic="true" — ensures the full message is read as one complete unit
  • Added aria-hidden="true" to AlertTriangleIcon — hides the decorative icon so screen readers announce only the text

Files Changed

  • frontend/src/App.tsx — 4 attribute additions to the write-mode warning banner only, no logic or styling changes

Testing

  1. Start dbportal with write mode enabled (--write flag)
  2. Open the app with NVDA (Windows) or VoiceOver (macOS)
  3. Confirm screen reader immediately announces: "Write mode enabled — INSERT, UPDATE, and DELETE operations are allowed. Use with caution."
  4. Confirm the warning is announced without any preceding unlabelled graphic description
  5. For non-screen-reader verification: inspect the warning <div> in DevTools — confirm role="alert", aria-live="assertive", and aria-atomic="true" are present

checkConnectionHealth was defined but never called after init().
Add a 30s setInterval useEffect so health status updates automatically
without requiring a page refresh.

Fixes Mananwebdev160408#144
…ccessibility

View mode and theme dropdown triggers had aria-haspopup/aria-expanded
but no aria-label — screen readers announced them as generic 'button'.
Decorative SVG icons and color dots inside buttons were also read aloud
causing double-announcement.

Changes:
- Add dynamic aria-label to view mode dropdown trigger
- Add dynamic aria-label to theme dropdown trigger
- Add aria-hidden to decorative icons inside view/theme dropdowns
- Add aria-hidden to ChevronIcon in both dropdown triggers
- Add aria-hidden to color dot divs in theme dropdown items

Fixes Mananwebdev160408#143
Search result divs had onClick but no role, tabIndex, or onKeyDown.
Keyboard-only users could not Tab to results or activate them.

- Add role=button to each result div
- Add tabIndex=0 to make results focusable via Tab
- Add onKeyDown handler for Enter and Space keys
- Add aria-label announcing table name and match count
- Add cursor:pointer for visual consistency

Fixes Mananwebdev160408#142
Warning banner had no ARIA live region — screen readers silently
ignored it, leaving visually impaired users unaware they were in
a mode allowing destructive database operations.

- Add role=alert to the warning banner div
- Add aria-live=assertive to interrupt and announce immediately
- Add aria-atomic=true to read the full message as one unit
- Add aria-hidden=true to the decorative AlertTriangleIcon

Fixes Mananwebdev160408#141
@Mananwebdev160408 Mananwebdev160408 merged commit 04b83be into Mananwebdev160408:main Jul 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[a11y]:Write-mode warning banner missing role="alert" — screen readers won't announce destructive mode

2 participants