Inconsistent checkbox placement when a hidden element is between a legend and .form-check
See original GitHub issue- Operating system: macOS 10.15.6
- Browser: Chrome 84.0.4147.105
In the alpha for 5.0.0 when a legend is followed by a hidden element (tested with .d-none and input[type="hidden"]) and div.form-check, then the checkbox will be on the same line as the legend but not the label, and also makes the checkbox not clickable (though it’s possible to check by focusing on it). This seems to be the case with normal checkboxes and switches.
Example problematic markup:
<form>
<fieldset>
<legend>Unexpected</legend>
<p class="d-none">Hello</p>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="foo">
<label class="form-check-label" for="foo">Foo</label>
</div>
</fieldset>
</form>
Produces this
I would expect it to lay out like this (and also be clickable)
Code Pen https://codepen.io/tegandbiscuits/pen/poygjPE
The current behavior is also not what happens with checkboxes in Bootstrap 4.
Also this seems to be able to be resolved by wrapping both the hidden element and .form-check in a div.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
H71: Providing a description for groups of form controls ... - W3C
The first element inside the fieldset must be a legend element, which provides a label or description for the group. Authors should avoid...
Read more >jQuery Plugin Development Beginner's Guide
movement and events, positioning through CSS rules, and, last but not least, interaction with jQuery code to actually show and hide the tooltip...
Read more >Help with hiding/unhiding -Check box 1 is checked
I have a form that will toggle multiple checkboxes hiding and unhiding ... then if checkbox 2 is checked Hide checkbox 1 and...
Read more >Amcharts - Checkbox legend - Stack Overflow
legendData ; var div = $("<div style='position:absolute; ... legendEntry.y + "px' " + "type='checkbox'" + (legend[i].hidden ?
Read more >legend.itemCheckboxStyle | highstock API Reference
The legend is a box containing a symbol and name for each series item or point item in ... The horizontal alignment of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thinking about this specific example again, you might just want to add a good ol’ fashioned
<div class="clearfix"></div>before the hidden element. That’ll fix the issue.Tried something using
display: contentsbut then realized support is pretty bad and buggy…There might be a better way using
gridor something, not sure yet.TBH, I’d be in favor of dropping
float: lefthere, since our standard build does not need it —no borders onfieldset— and it can be easily managed using.float-leftutility (which would then be opt-in).The better way around IMHO would be to add
clearutilities.