Skip to content

When using native checkboxes, the custom ones are shown too #288

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Closed
puehringer opened this issue Jul 1, 2021 · 1 comment · Fixed by #291
Closed

When using native checkboxes, the custom ones are shown too #288

puehringer opened this issue Jul 1, 2021 · 1 comment · Fixed by #291
Labels

Comments

@puehringer
Copy link
Contributor

Describe the bug
When setting nativeCheckboxes={true}, the custom checkboxes should be hidden and the input should be shown. Currently, it does not hide the custom checkboxes because of invalid CSS.

Reproduction steps
Just set nativeCheckboxes={true} in version 1.7.1: https://codesandbox.io/s/react-checkbox-tree-example-forked-24iu3?file=/src/components/Widget.js

Expected behavior
The custom checkboxes should be hidden.

Solution
The problem was introduced with this PR: 6eec84f#diff-cec3d603b60b2c5f9b645161b2887ee58e4ae213ef0adb914ce48fc5965eb32cR149-R150

Previously, the appended & caused the style to be in correct order:

.rct-checkbox {
  .rct-native-display & {
    display: none;
  }
}

but it was refactored to

.rct-checkbox .rct-native-display {
  display: none;
}

which is exactly the opposite order. In order to solve this, simply swap the classes, as a rct-checkbox is a child of rct-native-display:

.rct-native-display .rct-checkbox {
  display: none;
}

Screenshots
image

@jakezatecky
Copy link
Owner

Thanks for the report!

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants