Repository navigation
Mark menu label layout elements as presentational - #19671
Conversation
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
left a comment
There was a problem hiding this comment.
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
|
Agreed it's a problem, and it goes beyond the conflicting |
RStudio E2E - all platformsAll tests passed!
All platforms - commit |
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>hadrole="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 namelessgenericnodes inside themenuitem.formatMenuLabelnow writes an explicit<tbody>and gives it, the row, each cell and both<div>srole="presentation". In Chrome's accessibility tree, the File menu's 23 items now have nogenericnodes. 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 atitle, which Chrome exposed as agenericnode. Thetitlenow goes on the menu item instead, so the item has nogenericnode 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
formatMenuLabelwrites hasrole="presentation". The worktree change was checked in Chrome's accessibility tree against a dev server.Fixes #19656.