-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “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? Sign in to your account
Improve bootstrap3 checkbox theming #19006
Conversation
(Standard links)
|
OK, I think adding the To my reading of all the form examples from BS3, there are a couple problems:
It took me a bit to feel like I grokked the official BS3 guide. The BS3 guide isn't quite as clear about some definitions as the BS4/BS5 guides. I looked for an alternative BS3 guide, and this one is probably my favorite because the excerpts are framed more consistently/equivalently, and it speaks to some more edge-cases. But I think maybe an infographic can summarize it better. In these pictures, the sections are color-coded (e.g. a green tag corresponds to a green region). Form (Horizontal) On a wide/canonical screen, each label is horizontally adjacent to its input element. (On a narrow screen, they're split onto separate lines.) Form (Inline) One a wide/canonical screen, all labels and input elements form a continuous line. |
@totten thanks for the feedback. I've tweaked my PR to use the native bootstrap |
For comparison, here's a screenshot from my local And without it: FWIW, in Seven+Greenwich and Seven+Shoreditch, the checkboxes have the same problem. (The tangential issue about action-buttons is worst in Garland+Greenwich; it's not-as-bad/not-good in Seven+Greenwich; it's fine in Seven+Shoreditch.) (All observations in Firefox 82.) Aside: in #19005, when I used a toggle |
Standardizes our styling of checkboxes in boostrap markup to: `<label class="form-control"><input type="checkbox"> <span>Title</span></label>`
Yeah, that does look a little better: If you're aiming for that look/feel, then I can see how Personally, for me, the look/feel gets into an "uncanny valley" - it seems to me that most UIs with a toggle would either be less stylized (plain text) or more stylized (eg changing color-scheme or moving icons based on selection-status). But that's pure bike-shedding... and I'll get used to it in a day.... and I don't want to block cleanup on bike-shedding the layout. But let's put ourselves in the shoes of a themer aiming to use another BS3 theme (where the visual language of the checkbox is more traditional). These 3 checkboxes are going to look different (more-text-input-like) than any other checkbox on the site, and it's going to require an extra intervention to undo the effects of Here's an alternative way to make sure the styles match-up -- target |
ext/greenwich/scss/_tweaks.scss
Outdated
// height: $input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) | ||
padding: $padding-base-vertical $padding-base-horizontal $padding-base-vertical (20+$padding-base-horizontal); | ||
// font-size: $font-size-base; | ||
// line-height: $line-height-base; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are copied from the .form-control
rule. I commented out a few blurbs because I was checking to see which ones were really necessary. Could flip a coin on whether it's better to reproduce or remove these bits.
Overview
Adds some reusable styling for checkboxes in Bootstrap.
Before
After
Checkboxes appear in form-control styled boxes. Their label text is bold when checked.
Technical Details
This moves us toward the following markup as a standard:
This differs from vanilla bootstrap markup in 2 ways:
form-control
on the outer div. It's kinda hacking the theme a little bit, but it adds a nice box around the checkbox & label that visually matches other form elements.<span>
is so css rules can style the label text based on the checkbox state (using the+
operator).Both of these tweaks are compatible with vanilla bootstrap themes and do not require extra css (it just won't get the cool text effect).