Repository navigation
Description
When an R error in the Console has a traceback, the error box shows Show Traceback and, when the failing command is known, Rerun with Debug. Both work only with the mouse. Neither can be reached with the keyboard.
Why
- Both links are GWT
Anchors with nohref(src/gwt/src/org/rstudio/studio/client/common/debugging/ui/ConsoleError.ui.xml), so they aren't in the tab order. - Clicks are handled by one
ONCLICKlistener on the error box that checks the clicked element's class (ConsoleError.java). Nothing listens for keyboard input.
What keyboard users can do today
- Show Traceback expands the call stack attached to the error. Typing
traceback()at the prompt prints the same stack as console text. - Rerun with Debug switches the error handler to "Break in Code", then resends the failed command (
Shell.onRunCommandWithDebug). It saves the previous handler (ErrorManager.previousHandlerType_), apparently to restore it after the debug session. The keyboard route is Debug > On Error > Break in Code (errorsBreak, also in the Command Palette), then Up and Enter. That changes the setting until the user changes it back. The On Error commands arerebindable="false", so they can't be given a keyboard shortcut.
Neither route can be discovered from the error itself.
Constraint: the Console traps Tab
Tab in the Console input does code completion, so a keyboard user can't Tab out to the error box. Tab only moves focus when Tab Key Always Moves Focus is on (toggleTabKeyMovesFocus, Ctrl+Alt+[ on macOS, Alt+Shift+[ elsewhere). So making the links focusable only helps users who know about that mode. Any fix has to take this into account.
Possible approaches
- Focusable controls. Render the links as
<button>elements, or give themrole="button",tabindex="0"and Enter/Space handling. Give Show Tracebackaria-expanded. A native button'sclickbubbles to the existing listener. On its own this only helps when Tab moves focus, because of the trap above. - Commands with shortcuts. Add commands such as "Show Traceback for Last Error" and "Rerun Last Command with Debug" that act on the most recent Console error. Give them shortcuts, and show the shortcuts next to the links (e.g. "Show Traceback (Ctrl+Alt+…)"). This avoids the Tab trap, puts both actions in the Command Palette, and lets them be rebound. Things to decide:
- Which error the commands target. "Most recent error with a traceback" seems the natural choice.
- When the commands are enabled. Rerun needs a known command, and the links only appear for errors that have a traceback.
- Finding free shortcuts.
- Where focus goes when the traceback expands, and how a screen reader announces it.
The two approaches can be combined: commands as the main keyboard route, plus focusable controls for users who have Tab Key Always Moves Focus on.
Related: #10086 (hover flicker on the same links).
Activity
gtritchie commentedon Nov 17, 2026
The fix for #19645 (in progress) changes
ConsoleError.setTracebackVisible()to update the label through theshowTracebackText@UiField. It also drops the DOM walk, which was only needed for the virtual scroller that #16105 removed. Once Show Traceback is a button,aria-expandedcan be set in that same method:The method also runs from the constructor, so the attribute is correct from the start, including when
auto_expand_error_tracebacksis on.Use A11y.isInert in ConsoleError.canFocus
Show the focus ring on a Console error button focused by a menu command
Don't focus an older error box when the newest error has none
Announce a box-less newest error the same way after a retry
Make Console error actions usable from the keyboard (#19741)