question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

custom-checkbox and is-valid/is-invalid not working due to priority clashs

See original GitHub issue

Version

Bootstrap 4.0.0

Problem

Using a custom checkbox and the server side validation classes is-valid/is-invalid does not work.

The CSS definitions for this behavior are:

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
    background-color: #007bff;
}

.custom-control-input.is-invalid:checked ~ .custom-control-label::before {
    background-color: #e4606d;
}

The first definition provides the blue color on the normal checked checkbox. The second definition is supposed to override the color to the invalid red. If I count correctly, they have the same priority, so the second definition never applies.

<div class="custom-control custom-checkbox">
  <input checked type="checkbox" class="custom-control-input is-invalid" id="box1">
  <label class="custom-control-label" for="box1"></label>
</div>

Possible solutions

  • In the mixin form-validation-state specify also .custom-checkbox and others to match the full definition and make it more specific.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
whyleeecommented, Aug 6, 2018

The issue is clearly reproduced and visible online. Please reopen it and review

1reaction
acshefcommented, Apr 11, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found