Repository navigation
Redraw image checkmarks in Windows contrast theme colors - #19329
Conversation
Menu checkmarks and the Git/SVN changelist checkboxes are <img> bitmaps, which CSS forced colors mode does not recolor. Tag those images with classes, and under forced colors mask each one to an SVG of its glyph filled with CanvasText. Addresses #18494.
Keep checkmarks in disabled menu items at full contrast, matching their forced label color; omit the class attribute on menu icons that aren't checkmarks; look up the checkmark URIs once; shorten the CSS comment. Addresses #18494.
…eckmarks-contrast
Code review findingsActionable items from an automated review. Nothing here is a current bug. Suggestions
|
Full-opacity CanvasText made a checked disabled item look the same as an enabled one, since the label is forced to CanvasText too. Addresses #18494.
Emulates forced colors and checks that the Environment pane's memory menu checkmark, and each changelist checkbox state, is masked to an SVG glyph filled with CanvasText; and that the menu checkmark is unmasked with forced colors off. Addresses #18494.
|
Response to the review findings above: Applied
Not applied
|
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 #18494.
Menu checkmarks and the Git/SVN changelist checkboxes are
<img>bitmaps, which CSS forced colors mode does not recolor. Under a black contrast theme the menu checkmark was nearly invisible (about 1.4:1), and the changelist checkboxes kept their light box and blue check.Changes
AppCommand.createMenuImageHtmltags the menu checkmark image (normal or inverted) withrstudio-forced-colors-glyph rstudio-glyph-menu-check. Every menu checkmark goes through it: AppCommand,CheckableMenuItem,DeploymentMenuItem, Panmirror menu items, and the worktree menu.TriStateCheckboxCell.rendertags its image with the matchingrstudio-glyph-checkbox-on/off/indeterminateclass.themeStyles.css: under@media (forced-colors: active), a tagged image hides its bitmap and is masked to an SVG of the glyph filled withCanvasText. The fill usesCanvasTextrather thancurrentColor, because in Chromium an element withforced-color-adjust: noneresolvescurrentColorto the unforced author color. The rule also cancels the dark-menusfilter: invert. Checkmarks in disabled menu items are filled withGrayTextat full opacity, instead of the faded normal rendering, which drops a white checkmark on black to 2.5:1.@supports (forced-color-adjust: none) and (mask-image: none). As with the Checkbox state invisible with Windows Contrast Themes enabled #18493 rules, the@supportswrapper is what gets the media query past GWT's CSS2 parser. Its condition also leaves browsers without those features on the current rendering, instead of painting a solid square or nothing.Rendering with contrast themes off is unchanged.
The issue also lists the Packages pane and the unsaved-changes dialog, but those use native
<input type="checkbox">, which #18493 already covers.Testing
AppCommandMenuImageTestsandTriStateCheckboxCellTests, check the tagging. The tagging tests fail without the change;ant unittestpasses.ant draft: the new block reaches the compiled CSS unchanged.tests/panes/misc/contrast_theme_checkmarks.test.ts, emulates forced colors. It checks that the Environment pane's memory menu checkmark, and an<img>tagged for each changelist checkbox state, is masked to an SVG glyph filled withCanvasText, and that the menu checkmark is unmasked with forced colors off. Both tests fail without this change and pass with it, on Windows Desktop.CanvasText.The changelist checkbox is still not exposed to screen readers; that predates this change and is tracked in #19328.