Problem/Motivation
Several classes are missing from the standard output of the checkbox widget:
- LI items need "js-form-item js-form-type-checkbox checkbox form-check".
- Checkbox input fields need "form-checkbox form-check-input".
- Labels need "form-check-label".
This would be a simpler approach to resolving #2937191: Render using theme input and select instead of lists with links for checkboxes and dropdown and might be a step in the right direction while waiting for the bigger fix to be finished.
Steps to reproduce
Compare the final output of the JS-powered checkbox widget with a regular checkbox field - several classes are missing.
Proposed resolution
Add the standard Drupal classes to the checkbox widget output.
Remaining tasks
Provide a working MR.
User interface changes
Checkboxes from the checkbox widget will pick up the standard CSS for regular FormAPI checkbox.
API changes
n/a
Data model changes
n/a
Issue fork facets-3528483
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
damienmckennaIn my local testing this is working better than the current 3.0.0 branch - checkboxes float correctly beside the labels, long labels don't wrap underneath the checkbox, etc.
Comment #5
strykaizerComment #7
herved commentedI assume the reasoning behind this makes sense, but I noticed it can have side effects.
The added
checkboxclass breaks the styling on one of our projects that uses Bootstrap 3 and didn’t account for it.I wonder if this should instead use the
Drupal.themeJS API.Isn’t
form-checkBootstrap-specific?Also, does this follow classes from
core/modules/system/templates/form-element.html.twig? if so, why isn’tform-itemincluded?