Skip to content

Mark menu label layout elements as presentational - #19671

Merged
gtritchie merged 3 commits into
mainfrom
bugfix/menu-label-group-role
Nov 17, 2026
Merged

gtritchie merged 3 commits into
mainfrom
bugfix/menu-label-group-role

Conversation

@gtritchie

@gtritchie gtritchie commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

In Chrome on macOS, VoiceOver announced "group" after the text of menu items whose label is built by AppCommand.formatMenuLabel. That covers most RStudio menus, including the main menus. Only the label's layout <table> had role="presentation". Chrome exposed the browser-inserted <tbody>, the <tr>, the <td>s, and the <div> wrapping a right-hand image (as in the project list) as nameless generic nodes inside the menuitem.

formatMenuLabel now writes an explicit <tbody> and gives it, the row, each cell and both <div>s role="presentation". In Chrome's accessibility tree, the File menu's 23 items now have no generic nodes. Each has only its label and shortcut text.

Worktree items in the Git pane's branch menu had the same problem from their own markup: their label's subtitle <span> carried the worktree's full path as a title, which Chrome exposed as a generic node. The title now goes on the menu item instead, so the item has no generic node and gets the full path as its description. The tooltip now covers the whole item instead of just the path.

A new GWT unit test renders labels with a shortcut, an icon, a right image, a style name, and none of these. It checks that every layout element formatMenuLabel writes has role="presentation". The worktree change was checked in Chrome's accessibility tree against a dev server.

Fixes #19656.

Chrome exposed the tbody, tr and td of formatMenuLabel's layout table as
nameless generic nodes inside each menu item, which VoiceOver announced
as "group". Write an explicit tbody and give it, the row and each cell
role="presentation".

Addresses #19656
Chrome exposed the <div> wrapping a menu item's right image, such as the
open-in-new-window icon in MRU lists, as a nameless generic node, which
VoiceOver announces as "group". The test now checks every non-hidden
layout element in the label rather than only the table parts.

Addresses #19656

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings are on lines outside the diff, so they're here instead of inline. I checked both against Chrome 157's accessibility tree, using a page that copies the menu label markup.

1. Worktree items in the Git branch menu still contain a generic node. src/gwt/src/org/rstudio/studio/client/workbench/views/vcs/BranchToolbarButton.java:355 passes an HTML label containing <span class="..." title="<full path>">. Because the span has a title, Chrome exposes it as generic description="/Users/.../wt/feature-x" inside the menuitem. The same span without a title is ignored. formatMenuLabel only marks the elements it writes itself, so VoiceOver will probably still announce "group" for these items.

2. The right-hand image has both alt="" and aria-label (older than this PR, low severity). createRightImageHtml (AppCommand.java:815) sets alt="", aria-label, and title to the same text. The aria-label overrides the empty alt, so Chrome exposes image "Open in new session" description="Open in new session", and the menuitem's name becomes "shared-proj Open in new session". Putting the action in the item's name may be intended. The conflicting alt and the description that repeats the name are the problem.

The icon cell's <div> now has role="presentation" too, so the label
doesn't rely on the cell's aria-hidden to keep it out of the tree. The
role string is a static constant.

Worktree items in the Git branch menu put the full path in a title on
the subtitle <span>, which Chrome exposed as a generic node inside the
menu item. The title now goes on the menu item, which gets the full
path as its description.

The layout test now covers labels with an icon and with a style name,
and checks the hidden icon cell too.

Addresses #19656
@gtritchie

Copy link
Copy Markdown
Member Author

Agreed it's a problem, and it goes beyond the conflicting alt: the action is mouse-only, since activating the item from the keyboard sends no click on the image. Filed as #19670, which covers both the project menu and the worktree items.

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
5677 0 256 2
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1424 0 46 0
✅ desktop-macos 1420 0 51 0
✅ desktop-windows 1418 0 57 1
✅ server-linux 1363 0 54 1
✅ setup 48 0 32 0

View report online

⚠️ 33 shard report(s) are from a previous attempt of this run: shards that did not re-run, or that re-ran without producing one (the merge job warns about each).


All platforms - commit ba20165ef46bbdd8bc27932da2be81dff3092674 - Run #2328

@gtritchie
gtritchie merged commit 91fae51 into main Nov 17, 2026
77 of 78 checks passed
@gtritchie
gtritchie deleted the bugfix/menu-label-group-role branch November 17, 2026 23:11
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.

VoiceOver announces "group" on menu items with formatted labels

1 participant