Conversation
…can style the text based on the input's state
|
I agree this is a fix for #23426, however it does not address the issue where a whole set of radio buttons or checkboxes is valid/invalid, with an invalid description for the whole set. Considering just server side validation, a value for a field (which might be a single value <-> radio buttons, or multiple values <-> checkboxes) is invalid. This means that not the See the image for a more detailed view of what I mean. It was made with BS alpha 4 I believe. |
|
What is the status of this PR? If it is likely that the I see the problem @hiddewie shows, wouldn't adding something like the following work? fieldset.is-#{state} {
.form-check-description {
color: $color;
}
} |
|
Status is this needs reviewing, testing, and ideally merging :). |
|
Need to look at #23503 as well. |
|
Superseded by #25050. |
This fixes #23426, but might constitute as a breaking change.
What changes
Validating an input within our
.form-checkcomponent is straightforward—it'll handle:validand:invalidwith ease. However, styling the label's text based on the input's state is another thing. Let's look at what we have now:With the above HTML, you cannot style
Check me outin CSS based on.form-check-input's state. To make that happen, we need a sibling element to style, something like:That's what this PR changes all our checkboxes and radios to. This matches custom forms more and enables CSS-only validation of checkboxes/radios.
Breaking or non-breaking?
So, why the question of maybe breaks backward compatibility? It's not strictly required. Right now, there's no need to include it for anything but validation. However, it could help improve styling of disabled inputs as well. Here's the current CSS for disabled
.form-checks, which requires a parent class:bootstrap/scss/_forms.scss
Lines 218 to 228 in 5b8738a
With this change, we could do:
Thoughts?