Skip to content

Console output region has no visible focus indicator #19812

Done

Description

@gtritchie

Problem

The Console output region (#rstudio_console_output) can receive keyboard focus, either with Focus Console Output (Ctrl+Alt+2 on macOS, Alt+Shift+2 elsewhere, or Ctrl+`) or by tabbing to it. Nothing shows that it has focus, so keyboard users can't tell where focus went. This fails WCAG 2.4.7 Focus Visible (Level AA).

Steps to reproduce

  1. Run a command in the Console so it has some output.
  2. Press Ctrl+Alt+2 (macOS) / Alt+Shift+2 (Windows, Linux), or Tab from the Console toolbar until focus moves into the output.
  3. No focus indicator appears around the output region.

Cause

consoleStyles.css turns off the :focus-visible outline for both the output <pre> (.output, tabindex=0) and its trailing output chunk (.outputChunk, tabindex=-1, the element focusEnd() focuses):

.console .output:focus-visible,
.console .outputChunk:focus-visible {
   outline-style: none !important;
}

The rule came from #6518, where pressing Shift while text was selected in the output showed stray focus rectangles. That fix predates the switch to native :focus-visible (#15074), so a fix needs to show an indicator when focus arrives by keyboard without bringing back the rectangles from #6518.

Expected

A visible focus indicator on the Console output region whenever it has keyboard focus.

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions