Repository navigation
Expose Git/SVN changelist checkboxes, status icons, and table to screen readers - #19343
Conversation
TriStateCheckboxCell rendered a bare <img alt="">, which screen readers skip. It now carries role="checkbox", aria-checked (true, false, or mixed for a partially staged file), and an aria-label naming the file: "Stage <path>" in the Git pane and Review Changes window, "Commit <path>" in the SVN commit dialog. The empty alt is dropped, since it marks the image presentational. Addresses #19328
The status icons had empty alt text and their description lived only in
the span's title, which screen readers do not reliably read. The span is
now role="img" with the description as its aria-label, built by a shared
ChangelistTable.statusOpenTag used by both renderers. An untracked Git
file ("??") is described as "Untracked" instead of "Untracked/Untracked".
Addresses #19328
The existing tests called the removed one-argument constructor, so the GWT unit tests no longer compiled. They now pass a labeler, and new tests check role, aria-checked (true/false/mixed), aria-label, and the absence of alt for each state. Also tightens two comments. Addresses #19328
The changelist table had no accessible name. It is now "Changed files" in the Git pane, the Review Changes window, and the SVN pane, and "Files to commit" in the SVN commit dialog, whose checkboxes select files for the commit. Addresses #19328
gtritchie
left a comment
There was a problem hiding this comment.
Four findings. Keyboard operability of the checkboxes is known and out of scope, so it isn't listed.
| # | Finding | Origin |
|---|---|---|
| 1 | Conflicted files are named "Unmerged/Unmerged" | Pre-existing tooltip text; this PR makes it the accessible name and de-duplicates only ?? |
| 2 | "Stage <path>" checkbox stages every selected row on mouse click | Pre-existing behavior; the new per-file name makes it inaccurate |
| 3 | statusOpenTag's empty-description branch and the SVN labels are untested |
Introduced by this PR |
| 4 | "Modified/Modified" doesn't say which half is staged | Pre-existing tooltip text, newly the accessible name (suggestion only) |
| return ""; | ||
|
|
||
| // Git reports untracked files as "??"; both halves mean the same thing. | ||
| if (str.equals("??")) |
There was a problem hiding this comment.
Conflicted files are still named "Unmerged/Unmerged". Pre-existing in the tooltip; this PR makes it the accessible name and fixes the doubling only for ??.
SessionGit.cpp:627 passes the raw porcelain status through, so a both-modified conflict arrives as UU, and both halves map to unmergedCapitalized(). Handling UU alongside ?? covers it. AA/DD ("Added/Added", "Deleted/Deleted") do carry "both sides" information, so those can stay.
There was a problem hiding this comment.
Fixed in 489f727: UU is now described as "Unmerged", in the tooltip and the accessible name. AA and DD keep both halves.
| final Column<StatusAndPath, Boolean> stagedColumn = new Column<StatusAndPath, Boolean>( | ||
| new TriStateCheckboxCell<>(selectionModel_)) | ||
| new TriStateCheckboxCell<>(selectionModel_, | ||
| item -> constants_.stageFile(item.getPath()))) |
There was a problem hiding this comment.
The checkbox is named for one file, but a mouse click can stage every selected row. Pre-existing behavior; the new per-file name makes it inaccurate.
With a.R, b.R and c.R selected, mousing over a.R's checkbox sets mouseInCheckbox_, so isEditing() returns true. AbstractCellTable then fires the CellPreviewEvent with cellIsEditing=true, DefaultSelectionEventManager leaves the selection alone, and the FieldUpdater (line 80) fires StageUnstageEvent(!value, getSelectedItems()): all three files are staged by the control named "Stage a.R".
A screen reader activation sends a click without a mouseover, so the selection collapses to that row first and only that file is staged. In practice this mostly affects mouse and voice-control users ("click Stage a.R").
There was a problem hiding this comment.
Leaving this as is: a mouse click has always staged the whole selection, and changing what a click stages is a behavior change, not part of this labelling fix. Screen-reader activation stages only the named row. This could be its own issue.
| public static SafeHtml statusOpenTag(String desc) | ||
| { | ||
| String cls = resources_.cellTableStyle().status(); | ||
| if (StringUtil.isNullOrEmpty(desc)) |
There was a problem hiding this comment.
No test covers this branch, the SVN labels, or the Review Changes table. Introduced by this PR.
The empty-description branch can be reached: SVNStatusRenderer has an image for status ' ' (statusNone) but an empty description. A regression here (e.g. role="img" with an empty aria-label), or in "Files to commit" / "Commit <path>", would pass CI: TriStateCheckboxCellTests covers only the cell, and the e2e test only the Git pane. A GWT unit test of statusOpenTag for empty and non-empty descriptions would cover the first part.
There was a problem hiding this comment.
Not adding tests here. The empty-description case produces the old markup minus an empty title (no role, decorative icon), so a unit test would only pin that if. Covering the SVN labels would mean an SVN-backed e2e setup, which costs more than the strings are worth.
| "title=\"" + | ||
| SafeHtmlUtils.htmlEscape(descForStatus(str)) + | ||
| "\">")); | ||
| builder.append(ChangelistTable.statusOpenTag(descForStatus(str))); |
There was a problem hiding this comment.
Suggestion: "Modified/Modified" doesn't say which half is staged. Pre-existing tooltip text, newly the accessible name.
For MM or AM a screen reader user hears "Modified slash Modified" or "Added slash Modified". Sighted users can tell staged from unstaged by the icons' column positions. Something like "Staged: Added, unstaged: Modified" would carry the same information. Not blocking: the mixed checkbox state already signals a partial stage.
There was a problem hiding this comment.
Deferring. The text is the existing tooltip, and the "mixed" checkbox state already tells a screen reader user the file is partly staged. Rewording would change the tooltip for sighted users too, so it fits better in a separate change.
Both halves of "UU" mapped to the same description, so a conflicted file's tooltip and accessible name read "Unmerged/Unmerged". It now reads "Unmerged", as "??" reads "Untracked". "AA" and "DD" keep both halves. Addresses #19328
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
Fixes #19328.
The Git and SVN changelists (Git pane, Review Changes window, SVN pane, SVN commit dialog) were unreadable by screen readers:
TriStateCheckboxCellrendered a bare<img alt="">. The image now hasrole="checkbox",aria-checked(true,false, ormixedfor a partially staged file), and anaria-labelfrom a labeler the table supplies: "Stage " for Git, "Commit " for SVN. The emptyaltis removed, since ARIA in HTML allowsalt=""only on presentational images. The contrast-theme glyph classes from Image-based checkmarks ignore Windows contrast themes #18494 are unchanged.titleof the enclosing span. That span is nowrole="img"with the description as itsaria-label, via a sharedChangelistTable.statusOpenTagused by both renderers. An untracked Git file is described as "Untracked" instead of "Untracked/Untracked", in the tooltip too.New strings have English and French translations.
Tests
TriStateCheckboxCellTests(GWT unit) checks the role,aria-checked,aria-label, and absence ofaltfor all three states.e2e/rstudio/tests/panes/git/changelist_checkbox_a11y.test.tssets up partially staged, staged, and untracked files and checks the table name, each checkbox's name and state, each status icon's name, and that clicking a checkbox stages the file. Passes intest:server-dev.Known issues
The SVN commit dialog still has no keyboard way to toggle a file's checkbox. Git is already keyboard operable (Space/Enter toggles staging for the selected rows).
The table in general does not support keyboard operation. That is tracked separately.