Skip to content

Navigate between Console output chunks with the keyboard #19817

Description

@gtritchie

Problem

Keyboard users can only move into the Console output as a whole. Focus Console Output (Ctrl+Alt+2, or Alt+Shift+2 on Windows and Linux) focuses the most recent output, and Tab reaches the output region. There's no way to step back through earlier output (for example, the result of the command before last) without a mouse or a screen reader's own virtual cursor.

Background

The output region (#rstudio_console_output) is a <pre tabindex="0">. Inside it, each prompt cycle (the echoed command and its output) is a <span tabindex="-1" role="document"> chunk (ConsoleOutputWriter.outputToConsole()). A new chunk starts each time a prompt is written (ShellWidget calls ensureStartingOnNewLine()). Focus Console Output focuses the last chunk with content (ConsoleOutputWriter.focusEnd()).

After #19812, focus on a chunk outlines the whole output region, because an outline on an inline chunk traces each wrapped line.

Proposal

  1. Show which chunk has focus. Draw a rectangle around the focused chunk, and keep the whole-region outline for when the <pre> itself has focus. Making chunks display: block should give a rectangle without moving text, since each chunk starts on a new line. Check for extra blank lines from a chunk's trailing newline, for doubled newlines when copying across chunks, and that line trimming and the find bar still work.
  2. Move between chunks with the keyboard. While a chunk has focus, keys move focus to the previous or next chunk with content, optionally announcing the position (e.g. "Output 3 of 12").
    • The WAI-ARIA feed pattern is a close fit: Page Down / Page Up move between articles, and Ctrl+End / Ctrl+Home leave the feed. Today Page Up/Down, Home and End scroll the output, and most other keys are sent to the console input (Up/Down recall history), so the key handling in ShellWidget's SelectInputClickHandler would need to change while a chunk has focus.
    • Chunks have role="document" because of JAWS virtual cursor is not auto-activated in Console Output region #6884 (JAWS's virtual cursor wasn't activated in the output). Any role change (e.g. to feed articles) needs testing with JAWS, NVDA and VoiceOver; screen reader support for feeds is uneven.
    • Global commands (e.g. Focus Next / Previous Console Output) could also be added so the navigation works from outside the output, but they need shortcuts and a defined starting point when focus is in the input.

Keys, wording and roles are still to be decided.

Activity

  1. added this to the 2027.01 milestone on Nov 25, 2026
  2. self-assigned this
    on Nov 25, 2026
  3. gtritchie commented on Nov 25, 2026

    @gtritchie
    MemberAuthor

    How VS Code handles this

    From VS Code's current documentation (not tried hands-on). VS Code doesn't make individual output sections focusable. Its integrated terminal has two separate mechanisms, one for sighted keyboard users and one for screen reader users. The Debug Console, its closest equivalent to the RStudio Console, has no documented way to move between output items.

    Terminal: jumping between commands (needs shell integration, on by default)

    • Ctrl+Up / Ctrl+Down (Cmd+Up / Cmd+Down on macOS) scroll to the previous or next command and highlight it. With Shift added, they select to the previous or next command, so a command's output can be selected.
    • This scrolls the terminal; it doesn't move keyboard focus onto the output.
    • Supporting features: marks beside each command showing whether it succeeded or failed, a "sticky" header that keeps the current command at the top, and a sound when a command fails.

    Terminal: Accessible View (for screen readers)

    • Alt+F2 (Option+F2 on macOS, Shift+Alt+F2 on Linux) opens the whole terminal buffer as read-only plain text and switches the screen reader into browse mode.
    • Inside it, Go to Symbol (Ctrl+Shift+O, Cmd+Shift+O on macOS) lists the detected commands and jumps to one.
    • Alt+F1 shows the terminal's screen reader help.

    Debug Console (the REPL)

    • Supports Tab navigation and has an Accessible View of its output.
    • Ctrl/Cmd+Up and Ctrl/Cmd+Down move between its input box and its results, not between individual output items.

    What this suggests for RStudio

    Sources:

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

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions