Skip to content

Fix Console output focus outline after mouse focus; focus a hidden Console - #19823

Merged
gtritchie merged 5 commits into
mainfrom
bugfix/console-output-pointer-focus-outline
Nov 26, 2026
Merged

gtritchie merged 5 commits into
mainfrom
bugfix/console-output-pointer-focus-outline

Conversation

@gtritchie

Copy link
Copy Markdown
Member

Follow-up to #19818. Addresses #19812.

Outline after mouse focus

#19818 outlined the Console output whenever a chunk had focus without a mouse mark, and cleared that mark whenever focus left the output. Dialogs (ModalDialogBase) and the main menu bar (BaseMenuBar.FocusTracker) blur the focused element and restore it afterwards. So a mouse user who drag-selected output and then opened Global Options, or chose Edit > Copy on Server, got the keyboard outline.

The mark now records keyboard arrival instead: ConsoleOutputWriter.focusEnd(), the only keyboard route onto a chunk, sets rstudio-keyboard-focus, and a mousedown in the output clears it. The mark is kept when focus leaves, so a dialog opened from keyboard focus brings the outline back when it closes. The mouse mark remains only for the rule that hides :focus-visible on the output <pre> itself.

Focus Console Output with a hidden Console

Focus Console Output did nothing, and announced nothing, when the Console was minimized, behind another tab, or hidden by a zoomed pane. It now activates the Console and retries until focus can land, using the loop Focus Last Console Error already had (moved into a shared focusInConsole helper). If focus still can't land, it announces "Could not move focus to the Console output".

Testing

  • ConsoleOutputWriterTests: the keyboard mark is set by focusEnd(), cleared by mousedown, and kept when focus moves elsewhere; hasOutput() and canFocusEnd().
  • console_pane.test.ts: the hidden-Console restore cases now run for both commands, with a new Console-behind-another-tab case. 16/16 pass on desktop-dev. The six minimized/behind-tab Focus Console Output cases fail with the fix reverted.
  • Manual, on a dev Server: drag-select then Edit > Copy shows no outline; Ctrl+` shows it, and it returns after the dialog closes; a click in the output removes it.

PR #19818 hid the output outline with a mouse mark that was cleared
whenever focus left the output. A dialog or menu that handed focus back
to a clicked chunk then showed the outline to a mouse user. Mark
keyboard arrival in focusEnd() instead, and clear it on mousedown.

Addresses #19812.
Focus Console Output called focus() on a chunk the browser wasn't
rendering, so with the Console minimized, behind another tab, or hidden
by a maximized pane, nothing happened and nothing was announced. It now
activates the Console and waits for it to finish showing, sharing the
retry loop Focus Last Console Error already used.

Addresses #19812.
Run the hidden-Console restore cases for Focus Console Output as well as
Focus Last Console Error, and add a case with the Console behind another
tab.

Addresses #19812.
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
5854 0 265 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1467 0 49 0
✅ desktop-macos 1463 0 54 0
✅ desktop-windows 1460 0 60 2
✅ server-linux 1412 0 54 1
✅ setup 48 0 32 0

View report online


All platforms - commit f210cf10a9c5935e3c7be8fc76170fbb864d490f - Run #2532

@gtritchie
gtritchie merged commit c45c6b9 into main Nov 26, 2026
45 checks passed
@gtritchie
gtritchie deleted the bugfix/console-output-pointer-focus-outline branch November 26, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant