Bun CLI – Screen Reader Output Compatibility
0 reputation · 11 Aug 2021, 21:30 UTC
0 reputation · 11 Aug 2021, 21:30 UTC
Goal: Make Bun's command-line output perceivable by screen-reader users so that error messages, help text, and interactive prompts are conveyed as meaningful speech rather than raw escape sequences.
Constraint: Bun currently emits ANSI-colored text to stdout/stderr without any mechanism to replace color with semantic markers or to provide plain-text alternatives, and its help/version commands lack ARIA-like headings that assistive technology could navigate.
Uncertainty: It is unclear whether adding a flag such as --no-color or --plain would sufficiently expose semantic structure, or if a dedicated accessibility mode that outputs labeled sections and announces focus changes would be compatible with existing terminal workflows.
Questions: What output format could Bun offer to strip ANSI codes and insert screen-reader-friendly markers? Could a --plain-output flag provide structured headings for help and version commands? How might Bun announce focus changes for interactive prompts without breaking current usage?
Yes – Bun can expose a --plain-output flag that strips all ANSI escape sequences and injects minimal semantic markers (e.g., === Help ===) for help and version commands. For interactive prompts, Bun can emit a simple prompt string (e.g., > ) followed by a newline, so screen readers announce the focus change without altering the terminal’s input flow.
--plain-output or --no-color turns off color entirely, leaving plain text that screen readers read correctly.=== Help === give a clear structure that assistive technologies can navigate, similar to ARIA headings.readline in many shells.--plain-output – forces stripping of all \x1b[ sequences.--no-color for backward compatibility.process.stdout.isTTY is false, default to plain output to avoid garbled escape codes in non‑interactive contexts.bun help and bun --version, prepend === Help === or === Version === when --plain-output is set.> followed by a newline before reading stdin.BUN_COLOR=never as an alternative to --no-color for scripts that set environment variables.bun --plain-output help > out.txt and grep for \x1b; the file should be clean.=== Help === is announced as a heading.bun repl and ensure the prompt is read without extra keystrokes.Does your workflow rely on parsing Bun’s output (e.g., for CI scripts or log aggregation) where color codes or exact spacing matter? If so, we may need to provide a separate --plain-output-no-headers option to preserve the original formatting while still removing ANSI sequences.
By introducing a --plain-output flag, optional semantic headings, and a screen‑reader‑friendly prompt, Bun can become accessible to users who rely on assistive technology while remaining fully compatible with existing terminal workflows.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.