Repository navigation
Make search boxes' clear button a 24px target (WCAG 2.5.8) - #19869
Merged
Merged
Conversation
The clear (x) button that search boxes show once they hold text was an 11x11 button on top of the input. axe-core 4.13's target-size rule failed it (safe space 11px) and the input under it (147x15 and 122x15, safe space 0px). The button is now 24x24 around the same 11px icon, which stays where it was. The 18px box doesn't get taller: the target reaches 3px above and below it and across its right padding, so clicks there now clear the text. The main toolbar row is exactly 24px and clips its content, so the target fills it with no slack. - Windows lifts .search 1px; the button moves back down 1px there, so the toolbar doesn't clip it to 23px. Checked by adding the windows body class in Chromium on macOS. - The tab-overflow popup's search margin goes from 2px to 3px. With 2px the target overlapped the first tab by 1px. The popup is 2px taller (76px to 78px). - The keyboard focus ring stays on the icon rather than ringing the 24px button, which would overhang the box and be clipped. axe passes the buttons and inputs in the main toolbar, the Environment, History, Connections, Packages, Help and Tutorial panes, and the tab-overflow popup. In the Addins menu, Modify Keyboard Shortcuts and the data viewer, the target overlaps no other target and isn't clipped. Addresses #19786.
- Find the Environment search box by an id prefix inside the Environment panel, not the exact #rstudio_sw_environment: a rebuilt pane's widget gets a suffixed id (rstudio_sw_environment_0), as the file's first test already allows for. - Click 1px inside the clear button's top edge, and assert that point is above the visible box. The click had been at the box's top minus 2px, which on Windows, where the box is lifted 1px, is the target's top row exactly. - Log cleanup failures instead of throwing, so they can't replace the test's own error. Addresses #19786.
gtritchie
commented
Dec 1, 2026
gtritchie
commented
Dec 1, 2026
gtritchie
commented
Dec 1, 2026
The icon's ring repeated the app-wide focus ring's values (#8AA9DB solid 2px, -1px offset) in a rule of its own, so a later change to the ring would have skipped it. Its selector now joins the app-wide rule's selector list. The ring looks the same: computed outline on the focused icon is rgb(138, 169, 219) solid 2px with a -1px offset, before and after. Addresses #19786.
The cleanup's comment says a cleanup problem can't hide the test's own
error, but only the fill('') calls were guarded. If the page closes, the
unguarded Escape press threw "Target page, context or browser has been
closed" in place of the real failure. It is now logged like the others.
Addresses #19786.
The test didn't cover the Windows offsets, and neither of its checks would catch losing them. With them removed, the main toolbar clips the button's top row (button 34-58px, toolbar 35-59px), yet axe still passes it, since it goes by the button's box, and a click 1px inside its top edge still lands on the button. - Every corner of each clear button must hit-test to the button, which catches clipping. - The checks run again with the windows class on body, which applies the 1px lift and the offsets. Only the buttons are scanned then: the lift leaves the Search environment input short of spacing, a separate item on #19786. Against the branch with the Windows offsets deleted, the test fails on the Go to File/Function button's top corners. With them, the spec passes. Addresses #19786.
Member
Author
|
Re-review of 67978d8, 256f16b and b766994: all three earlier comments are addressed, and I resolved their threads.
I found nothing new. I read the changes but didn't run the test. |
RStudio E2E - all platformsAll tests passed!
All platforms - commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Addresses #19786.
The clear (×) button that search boxes show once they hold text was the last open item on #19786. It was an 11×11 button on top of the search input, which is stretched across the whole box on first focus so that its focus ring covers the box. In the main toolbar's Go to File/Function box and in pane search boxes, axe-core 4.13's
target-sizerule reported both as violations:Nothing changes visibly.
Approach
24px target, same 18px box (
themeStyles.css).clearSearchrules, a base rule and a later override of itstop, are merged into one.Windows:
body.windows .searchis lifted 1px (#19163). The button moves back down 1px there, so the main toolbar doesn't clip it to 23px.Tab-overflow popup (Switch to Tab): its search box's margin goes from 2px to 3px. With 2px the target overlapped the first tab by 1px. The popup is 2px taller (76px to 78px).
Focus ring (
focus-visible.css): it stays on the icon, as before. A ring on the 24px button would overhang the box and be clipped by the main toolbar.Not changed: the search inputs are 15px tall and pass only through the spacing exception. On Windows, two of them get Needs Review at 23–23.2px because of the 1px lift, which predates this change. That's recorded on #19786 for a later fix.
NEWS: the existing #19786 entry ("some toolbar controls … were too small or too close to their neighbors to click easily") covers this, so it's unchanged.
rstudio-pro: no pro-only code uses the search widget or styles
.search, so no changes are needed.Automated Tests
Adds a test to
e2e/rstudio/tests/toolbar/toolbar_target_size.test.ts. It types into the Go to File/Function and Environment search boxes so their clear buttons show, then:target-sizerule on both boxes and expects no violations or Needs Review results. It first checks that the scan measured both inputs and both buttons, so an empty scan can't pass.windowsclass onbody, which applies the 1px lift and the Windows offsets. The inputs are left out there because of the separate Windows-only item on Controls are smaller than the WCAG 2.2 minimum target size and too closely spaced #19786.Results:
main's CSS, it fails, reporting both clear buttons (11×11) and both inputs./code-reviewfinding not acted on:button { cursor: pointer }rule already applies to it, and the pointer shows at the target's edges.QA Notes
Checked on RStudio Server (Chrome, macOS) with axe-core 4.13's
target-sizerule:windowsclass tobody: the targets stay in place, inside the toolbar rows.Not checked: Desktop, Windows itself, Linux, Firefox, Safari, dark themes, the VCS history window, the object explorer, the Git branch menu, and rstudio-pro.
To check by hand:
Documentation
N/A
Checklist
NEWS.md