Skip to content

Announce completion popup messages, types, and help to screen readers - #19805

Merged
gtritchie merged 11 commits into
mainfrom
feature/completion-popup-a11y-19533
Nov 25, 2026
Merged

gtritchie merged 11 commits into
mainfrom
feature/completion-popup-a11y-19533

Conversation

@gtritchie

@gtritchie gtritchie commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Fixes #19533.

Follow-up to #6167 and #6168: screen readers now hear what the R completion popup, the console history popup, and the C/C++ completion popup show besides the selected item.

  • Messages are announced. "(No matches)", server errors, "(No matching commands)", and "Not all items shown" below a truncated list are announced through AriaLiveService. A message refreshed as the user types is announced only when it changes. The announcements can be turned off as "Completion messages" in Accessibility options.
  • Completion types are read. Each R and C/C++ completion follows its name with its type as visually hidden text, so an option reads e.g. "cat, function, {base}" or "NumericMatrix, class". Labels come from the completion's type rather than its icon, since several types share an icon. Types with no known kind get no label. Neither do completions that reuse R's types with other meanings: Python and SQL completions, and completions from a package's own provider (those with a help handler, e.g. a Python module completed with $ from R through reticulate). To tell SQL completions apart, SQL schema, table, and field completions now report their language as SQL instead of defaulting to R.
  • Help is linked to the selected item. Once help is shown for the selected item, its aria-describedby points at that help, and moving the selection unlinks it. Help that arrives after the selection (most R help, which loads from the server) is read with the item's description, e.g. when re-reading it, rather than as it arrives.

Linking help exposed some problems in how help reaches the popup, which are fixed here:

  • Help that finished loading after the selection moved on was still shown beside the new selection. It's now shown only if its item is still selected, and a failed request for an item the user moved past no longer clears the selected item's help or shows an error.
  • Help was cached and matched by name and type only, so e.g. filter {dplyr} and filter {stats} shared help. It's now keyed by type, name, source, help handler, and language.
  • Every help popup got the same element id, so an item could point at another popup's help. Items now point at a uniquely id'd element in their own popup.
  • The data preview frame in the help was titled "title"; it's now "Data preview".

CompletionPopupPanel.showProgress, which had no callers, is removed.

No NEWS entry: this builds on #6167 and #6168, which haven't been released.

Testing

  • New GWT unit tests in CompletionPopupPanelTests (announcements, help linking, per-popup help ids) and a new QualifiedNameTests (type labels, including none for Python, SQL, and package-provider completions), registered in RStudioUnitTestSuite.
  • New R test test-sql-completions.R: SQL table and field completions report their language as SQL (skipped without DBI and RSQLite).
  • Manually in RStudio Server (Chrome), checking the accessibility tree and live regions: option names and help descriptions in the console's R completions, "(No matches)" and "(No matching commands)" announcements, and the C/C++ popup's type labels, tooltip linking, and "(No matches)" in an Rcpp file.
  • With screen readers: VoiceOver with Safari (RStudio Server) on macOS, and NVDA with RStudio Desktop built from this branch on Windows 11. Both work as expected, except that help is sometimes not read with the selected item, as described in the review-decisions comment.

Screen readers now hear the messages these popups show in place of, or
below, their list: "(No matches)", server errors, "(No matching
commands)" in the console history popup, and that a truncated list
doesn't show all items. A message refreshed as the user types is
announced only when it changes. The announcements can be turned off as
"Completion messages" in the accessibility options.

Addresses #19533.
Each completion's type was shown only by its icon, which screen readers
skip. R and C/C++ completions now follow their name with the type as
visually hidden text, so an option reads e.g. "cat, function, {base}".
Labels follow the completion's type rather than its icon, since several
types share an icon; types whose kind isn't known get no label.

Addresses #19533.
The help shown beside a completion list wasn't associated with the
selected item, so screen readers didn't read it. The selected item's
aria-describedby now points at the help once it's shown for that item,
in the R and C/C++ popups, and moving the selection unlinks it. Help
that arrives after the selection (most R help, which loads from the
server) is read with the item's description, e.g. on re-reading it,
rather than as it arrives.

The help's data frame preview frame was titled "title"; it's now
"Data preview", since its title is part of that description.

Addresses #19533.
Help that finished loading after the selection moved on was still shown,
beside and now linked to the newly selected item. It's now dropped
unless its item is still selected. A list refreshed as the user types
also linked the help it was still showing, for the previous selection,
to its new selection; only help displayed for the selection links now.

Addresses #19533.
Help was cached, and checked against the selection, by name and type
only, so filter {dplyr} and filter {stats} shared help: one's help was
shown beside, and linked to, the other. Help is now keyed by its type,
name, source, and help handler. Responses for items the user has moved
past are cached rather than dropped, and a failed request for such an
item no longer clears the selected item's help or shows an error.

Addresses #19533.
Every completion help popup got the same element id, because ids are
made unique only against elements already in the page, and an editor
creates a completion popup per language before any is shown. A list
item's aria-describedby could then name another popup's help. Items now
point at an element inside their own popup's help with a unique id.

Addresses #19533.
Python and SQL completions reuse R's completion types with other
meanings, so a SQL table read as a "data frame", its fields as
"dataset", and a schema or Python module as "environment". Their
types are no longer named. SQL schema, table, and field completions now
report their language as SQL; they defaulted to R.

Addresses #19533.
Announcing an empty message cancels a pending announcement and blanks
the live region. Only the R completion popup skipped empty messages; the
check now lives in CompletionListAria.announce, used by every popup.
CompletionPopupPanel.showProgress had no callers.

Addresses #19533.
Custom help handlers resolve topics per language, so R and Python items
with the same type, name, source, and handler could share cached help.

Addresses #19533.
@gtritchie gtritchie added this to the 2026.12 (Parrot Balsam) milestone Nov 24, 2026
@gtritchie

gtritchie commented Nov 24, 2026 •

Copy link
Copy Markdown
Member Author

Review findings deliberately not acted on, for later reviews:

  • No behavioral tests for HelpStrategy's async handling (only-selected-item check, help key, stale errors). A test needs a fake CodeToolsServerOperations, which spans six interfaces and about 47 methods: roughly 250 lines of stubs, coupled to all of them, to cover a few lines of guard logic. Narrowing HelpStrategy's dependency to the three help calls would make a small fake possible, but changes its GIN-injected constructor, so it's left out of this PR. The logic was checked by hand in the browser.
  • No unit tests for the C/C++ popup's announcements and tooltip linking, or the history popup's announcement. CppCompletionPopupMenu needs a DocDisplay (the full editor interface) to construct, and the history popup's announcement goes through HistoryCompletionManager and the ginjector. Both were checked by hand in the browser.
  • Help that arrives after clearCache() refills the cache. Accepting a completion clears HelpStrategy's cache, and a help request still in flight can then repopulate it. Main also caches late responses this way; this PR doesn't change it.
  • Help isn't always read with the selected item (known behavior). Help is read only if it's already shown when the item is selected. The first item's help is requested 600 ms after the popup opens, and uncached help comes from the server, so in both cases it arrives after the screen reader has read the item. Cached help, e.g. when returning to an item, is read. With VoiceOver in Safari this sounds unpredictable: help is usually missing on the first item, but present after arrowing down or back. Announcing help that arrives late through the live region would fix it, but would be chatty while arrowing; that approach was considered and deliberately not taken.
  • File, folder, and string completions leave the previous item's help showing. HelpStrategy.showHelp does nothing for those types, so the last item's help stays visible beside them. This predates the PR and is visual only: moving the selection unlinks the help, so screen readers don't read it with the new item.

Completions from a package's own provider, which set a help handler,
use R's completion types with the package's meanings: completed with $
from R, a Python submodule such as os$path is an ENVIRONMENT and read
as "environment". Their types are no longer named.

Addresses #19533.
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
5808 0 266 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1456 0 49 0
✅ desktop-macos 1450 0 55 1
✅ desktop-windows 1451 0 60 0
✅ server-linux 1399 0 54 1
✅ setup 48 0 32 0

View report online


All platforms - commit 96c19668b9cef0a1113d7911b5332a35ee8e7a29 - Run #2508

@gtritchie
gtritchie merged commit b0233cd into main Nov 25, 2026
49 checks passed
@gtritchie
gtritchie deleted the feature/completion-popup-a11y-19533 branch November 25, 2026 00:05
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.

Completion and history popups: announce messages, completion types, and help

1 participant