Skip to content

Commit

Permalink
Remove .col-form-legend in favor of .col-form-label (#24932)
Browse files Browse the repository at this point in the history
* chore: sync with twbs (#1)

* Make styling of grouped option buttons class-based

Referencing #23728, styling grouped radio and checkbox buttons should not require the data-toggle attribute.

* Fix installing deps in our webpack docs

* Fix nested cards on card group (#24766)

* Update popper.js to v1.12.9. (#24797)

* Don't run postcss for `dist/css/*.min.css` files. (#24676)

* Change the text color to dark on bg color warning examples (#24805)

* Remove unused file and bundle ie-emulation-modes-warning.js with docs.min.js (#24825)

* Remove the unused assets/js/ie10-viewport-bug-workaround.js.

* Combine ie-emulation-modes-warning.js with docs.min.js.

* Typos in grid.md (#24828)

Fixed typos in offsetting section of grid.md

* Fix dropup example code

* Update devDependencies. (#24829)

* Add support for fractional viewport widths (zoom/high-dpi displays) (#24299)

* Change breakpoint  max- calculation to fractional values
* Update docs to reflect fractional max-width breakpoint values
* Add fractional max-width to offcanvas example
* Add documentation and SCSS comment for fractional viewport support

* Add a simple script to generate SRI hashes for our assets. (#24814)

* Allow us to run our unit test on differents jquery version

* Run karma tests in parallel.

* Update typography docs (#24863)

* closes #24450

* Rewrite custom form check backgrounds (#24697)

* Rewrite custom form check backgrounds

Previously, this was all just a background-color and background-image. When we restored the gradients though, we had two background-images competing on the same element, causing rendering glitches. This refactors that code, creating a mixin to simplify things, so we can we easily use two background-images (SVG icon and gradient) when -gradients is set to true.

Fixes #24598

* restore default vars

* Revamp custom check and radio backgrounds

Instead of applying multiple background-image's to the same element, we're adding a new ::before pseudo-element to layer the background-images. Gradients go on the .custom-control-indicator while their icons go on the ::before element. This allows us to shave some bytes from when we compile and we previously needed to redeclare the background-image for the icon if you changed the gradient.

* remove now unused mixin

* mention change in migration docs

* lets the centered modal have any height (#24803)

* Custom select updates (#24699)

* Add support for size attribute on custom selects

* Add large custom select, document it and the small variant

* fix custom select focus state

* fix custom file input focus styles

* remove empty line

* Update package.json. (#24582)

1. Use the same jQuery version in jspm
2. Update the files to only include the source and dist folders

* Use Jekyll's `smartify` filter when possible. (#24866)

* Darken outline hover color to match default button hover (#24150)

* Fix Issue #24144

Alter button-outline-variant mixin to darken hover and active background in same fashion as filled button.

* Fix Issue #24144

Filled button on hover should utilize the same color-yiq mixin so that theme buttons match

* default values, fix mixin

* rename it

* document it

* add migration note

* fixes #24728

* Remove unused CSS. (#24872)

* tab.js: do not remove fade class if there's no initial active pane

* Restore currently unused variables (#24891)

* Replace lint-vars.sh with a Node.js script. (#24860)

Also, include it in the `css` npm script since it's instant.

* Fix docs horizontal scrollbar (#24878)

* Fix docs horizontal scrollbar in Components > Modal

* Add overflow to docs example class

* Drop the handleUpdate() variant

While I understand the variant covers the "get a particular plugin instance" case from http://getbootstrap.com/docs/4.0/getting-started/javascript/#programmatic-api it seems weird that we do it here but not everywhere else in the docs (randomly checking other pages, we seem to stick to the documented methods as written on those pages). As this isn't properly explained as is, and as it adds nothing (more of a preference for authors), it would be easier to just drop the variant and stick with the documented method as outlined later on in the same page (avoids having to go off on a "why should you use this instead of that" tangent here).

* Combine path and remove variable used in one place. (#24873)

* Update devDependencies and gems. (#24876)

* Override padding on radio input label (#24899)

We could tell folks to nix the class, we could tell them to override it, or we could add another modifier of some kind to address this. None of them seem particularly useful, but the padding override feels the most approachable and clearly documentable. Added this here to close #24844.

* Update README.md (#24912)

* Work around Travis failures.

Note that we should revert this when the issue is fixed.

* Revert the Travis workaround. (#24926)

The issue has been fixed.

* add .col-form-legend-lg and .col-form-legend-sm classes

* document .col-form-legend-{size}

* trash .col-form-legend completely

One class fits all

* Update forms.md

* consolidate copy

* property order
  • Loading branch information
tmorehouse authored and mdo committed Dec 2, 2017
1 parent 1d6e371 commit 9de141f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
8 changes: 3 additions & 5 deletions docs/4.0/components/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,7 @@ More complex layouts can also be created with the grid system.

#### Horizontal form

Create horizontal forms with the grid by adding the `.row` class to form groups and using the `.col-*-*` classes to specify the width of your labels and controls.

Be sure to add `.col-form-label` to your `<label>`s as well so they're vertically centered with their associated form controls. For `<legend>` elements, you can use `.col-form-legend` to make them appear similar to regular `<label>` elements.
Create horizontal forms with the grid by adding the `.row` class to form groups and using the `.col-*-*` classes to specify the width of your labels and controls. Be sure to add `.col-form-label` to your `<label>`s as well so they're vertically centered with their associated form controls.

At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we've removed the `padding-top` on our stacked radio inputs label to better align the text baseline.

Expand All @@ -382,7 +380,7 @@ At times, you maybe need to use margin or padding utilities to create that perfe
</div>
<fieldset class="form-group">
<div class="row">
<legend class="col-form-legend col-sm-2 pt-0">Radios</legend>
<legend class="col-form-label col-sm-2 pt-0">Radios</legend>
<div class="col-sm-10">
<div class="form-check">
<label class="form-check-label">
Expand Down Expand Up @@ -425,7 +423,7 @@ At times, you maybe need to use margin or padding utilities to create that perfe

##### Horizontal form label sizing

Be sure to use `.col-form-label-sm` or `.col-form-label-lg` to your `<label>`s to correctly follow the size of `.form-control-lg` and `.form-control-sm`.
Be sure to use `.col-form-label-sm` or `.col-form-label-lg` to your `<label>`s or `<legend>`s to correctly follow the size of `.form-control-lg` and `.form-control-sm`.

{% example html %}
<form>
Expand Down
21 changes: 4 additions & 17 deletions scss/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,13 @@ select.form-control {
// Labels
//

// For use with horizontal and inline forms, when you need the label text to
// align with the form controls.
// For use with horizontal and inline forms, when you need the label (or legend)
// text to align with the form controls.
.col-form-label {
padding-top: calc(#{$input-padding-y} + #{$input-border-width});
padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
margin-bottom: 0; // Override the `<label>` default
margin-bottom: 0; // Override the `<label>/<legend>` default
font-size: inherit; // Override the `<legend>` default
line-height: $input-line-height;
}

Expand All @@ -107,20 +108,6 @@ select.form-control {
}


//
// Legends
//

// For use with horizontal and inline forms, when you need the legend text to
// be the same size as regular labels, and to align with the form controls.
.col-form-legend {
padding-top: $input-padding-y;
padding-bottom: $input-padding-y;
margin-bottom: 0;
font-size: $font-size-base;
}


// Readonly controls as plain text
//
// Apply class to a readonly input to make it appear like regular plain
Expand Down

0 comments on commit 9de141f

Please sign in to comment.