[EuiCheckbox][EuiRadio] Fix checkboxes/radios without labels not being clickable #5149
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.
Summary
closes #5145 (NB: This bug only exists in 37.6.1, and should be fixed in 37.6.2)
#5130 updated the
euiScreenReaderOnlymixin (whichEuiCheckboxandEuiRadioboth use) to includeclip(0 0 0 0)CSS (to prevent scrolling issues caused by absolute positioning). Per the QA section of that PR, I tested the change against the normal checkbox/radio examples in our docs, but did not test them against checkbox/radios with no labels (which I hadn't realized functioned slightly differently than their counterparts with labels).Checkboxes and radios without labels actually do not want the standard
euiScreenReaderOnlybehavior. The visually hidden input actually overlays the visually displayed element with a set height/width, unlike SR behavior which moves the hidden element totally offscreen.As such, I decided the cleanest solution would be to only apply the
euiScreenReaderOnlyCSS to checkboxes/radios with labels (using:not()), thus negating the need for checkbox/radios to override any partseuiScreenReaderOnlyCSS.Before
After
Checkboxes/radios with labels remain the same:
QA
Labelinput. Confirm the inputs are still interactable (NB: the checkbox playground doesn't change state, but the radio playground does)Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for the any docs examples- [ ] Added or updated jest tests- [ ] Checked for breaking changes and labeled appropriately