Repository navigation
Description
Two menus put an image on the right of some items. Clicking the image opens the item in a new R session:
- In the project menu, in RStudio Desktop and in RStudio Server when multiple sessions are enabled, each recent project has the image, labeled "Open project in a new R session".
- In the Git pane's branch menu, each worktree other than the current one has the image, labeled "Open worktree in a new session", when a new session can be opened.
The image has two accessibility problems in both menus.
Screen readers announce an action the keyboard can't perform
createRightImageHtml (AppCommand.java#L797-L810) writes the image as:
<img class="menuRightImage" alt="" aria-label="Open project in a new R session"
title="Open project in a new R session" ...>alt="" would make the image decorative, but aria-label is a global ARIA attribute, so the image keeps its role and gets that name. The menu item's name comes from its content, so it includes the image's name, and title adds the same text again as the image's description. In Chrome:
menuitem "~/proj/a.Rproj Open project in a new R session"
image "Open project in a new R session" description="Open project in a new R session"
A screen reader user hears that the item opens the project in a new R session, but pressing Enter on it opens the project in the current session.
The new-session action is mouse-only
ToolbarMenuBar.onBrowserEvent (ToolbarPopupMenu.java#L408-L413) records whether a click event's target is the right image, and ProjectPopupMenu passes that to ProjectMRUList.setOpenInNewWindow. The worktree items read the same flag through menu_.wasRightImageClicked() (BranchToolbarButton.java#L96-L101). Keyboard activation sends no click, so without a mouse there is no way to open a recent project or a worktree in a new session from these menus. The keyboard alternative, File > Open Project in New Session..., goes through a file chooser instead of the recent project list.
Possible fixes
- Remove
aria-labelfrom the image, keepingtitleas the mouse tooltip, so each item's name is just its project path or worktree. This removes the misleading announcement but not the keyboard gap. - Give the new-session action a keyboard path, such as a modifier with Enter (announced with
aria-keyshortcutsand a description) or a submenu for each project or worktree.
Found while working on #19656.
Activity
[-]Project menu's open-in-new-session image is mouse-only and misnames menu items[/-][+]Open-in-new-session menu images are mouse-only and misname menu items[/+]