Fullscreen table and Mermaid views don't move, keep or restore keyboard focus

Aperta
#731 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start in the fullscreen overlay for tables and Mermaid diagrams, which renders role="dialog" and aria-modal="true", and in the "View fullscreen" button that opens it. Reproduce on the playground and check document.activeElement after opening and closing. Done when focus moves to the close button on open, Tab stays inside the dialog or the page behind it is inert, and focus returns to the opening button on close.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Description

The fullscreen overlay for tables and Mermaid diagrams renders role="dialog" and aria-modal="true", but it never moves focus into the dialog:

  • After opening, focus stays on the "View fullscreen" button, which is now hidden behind the overlay.
  • Tab moves through page content behind the overlay.
  • Closing the overlay drops focus to <body>, so keyboard and screen reader users lose their place.
Steps to Reproduce
  1. Open https://streamdown.ai/playground (the default content includes a table and Mermaid diagrams).
  2. Click "View fullscreen" on the table.
  3. Check document.activeElement. It is still the "View fullscreen" button behind the overlay.
  4. Press Tab. Focus moves to a "Download file" button of a code block behind the overlay.
  5. Click the close (X) button. document.activeElement is now <body>.

The same happens with "View fullscreen" on a Mermaid diagram.

Expected Behavior

Follow the WAI-ARIA modal dialog pattern:

  • When the dialog opens, move focus into it (for example to the close button).
  • Keep Tab inside the dialog, or make the content behind it inert.
  • When it closes, return focus to the "View fullscreen" button that opened it.
Actual Behavior

Focus never enters the dialog, Tab reaches hidden content, and focus is lost on close.

Code Sample
import { Streamdown } from "streamdown";
import { mermaid } from "@streamdown/mermaid";

const markdown = `| Feature | Status |
| --- | --- |
| Tables | Supported |

\`\`\`mermaid
flowchart LR
  A --> B
\`\`\``;

export function Example() {
  return <Streamdown plugins={{ mermaid }}>{markdown}</Streamdown>;
}
Streamdown Version

2.7.1 (also on streamdown.ai/playground)

React Version

19.3.1

Browser(s)

Chrome (desktop)

Operating System

macOS

Additional Context

Neither fullscreen component has any focus handling: there is no focus() call, focus trap or inert in either. A fix could:

  • remember document.activeElement when opening;
  • focus the close button after the dialog mounts;
  • set inert on the rest of the page while open;
  • return focus to the remembered element on close.

Related: #506 added role="dialog" and aria-modal to the Mermaid overlay, but focus handling is still missing.

Lingua principale
TypeScript
Stelle
5.8k
Fork
334
Merge medio
2g 4h
PR unite (30g)
33

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/streamdown

Tutte le issue di vercel/streamdown

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.