From 3007d4b4353fd0b8f3f65d660e19168e8400ee20 Mon Sep 17 00:00:00 2001 From: Martijn Cuppens Date: Tue, 4 Dec 2018 21:22:12 +0100 Subject: [PATCH 01/56] Stretched link --- scss/_utilities.scss | 1 + scss/utilities/_stretched-link.scss | 19 ++++ site/_data/nav.yml | 1 + site/docs/4.1/utilities/stretched-link.md | 100 ++++++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 scss/utilities/_stretched-link.scss create mode 100644 site/docs/4.1/utilities/stretched-link.md diff --git a/scss/_utilities.scss b/scss/_utilities.scss index 913fb852d58e..a5de31ba6a50 100644 --- a/scss/_utilities.scss +++ b/scss/_utilities.scss @@ -11,6 +11,7 @@ @import "utilities/screenreaders"; @import "utilities/shadows"; @import "utilities/sizing"; +@import "utilities/stretched-link"; @import "utilities/spacing"; @import "utilities/text"; @import "utilities/visibility"; diff --git a/scss/utilities/_stretched-link.scss b/scss/utilities/_stretched-link.scss new file mode 100644 index 000000000000..fb5066bf55dd --- /dev/null +++ b/scss/utilities/_stretched-link.scss @@ -0,0 +1,19 @@ +// +// Stretched link +// + +.stretched-link { + &::after { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1; + // Just in case `pointer-events: none` is set on a parent + pointer-events: auto; + content: ""; + // IE10 bugfix, see https://stackoverflow.com/questions/16947967/ie10-hover-pseudo-class-doesnt-work-without-background-color + background-color: rgba(0, 0, 0, 0); + } +} diff --git a/site/_data/nav.yml b/site/_data/nav.yml index 7b6ff7cd977e..3c101760742d 100644 --- a/site/_data/nav.yml +++ b/site/_data/nav.yml @@ -70,6 +70,7 @@ - title: Shadows - title: Sizing - title: Spacing + - title: Stretched link - title: Text - title: Vertical align - title: Visibility diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md new file mode 100644 index 000000000000..53907ceee26d --- /dev/null +++ b/site/docs/4.1/utilities/stretched-link.md @@ -0,0 +1,100 @@ +--- +layout: docs +title: Stretched link +description: Easily make an element which contains a stretched link clickable. +group: utilities +--- + +Adding the `.stretched-link` class to a link will make the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block) of the `::after` pseudo element of the link clickable. In most cases, this means that an element with `position: relative;` which contains a link with the `.stretched-link` class is clickable. + +Cards are relative by default, so in this case you can safely add the `.stretched-link` class to a link in the card. + +{% capture example %} +
+ {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text=" " title="Card image cap" %} +
+
Card with stretched link
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+ Go somewhere +
+
+{% endcapture %} +{% include example.html content=example %} + +Media objects are not relative by default, we need to add the `.position-relative` here to prevent the link from stretching outside the media object. + +{% capture example %} +
+ {% include icons/placeholder.svg width="144" height="144" class="mr-3" text=" " title="Generic placeholder image" %} +
+
Media with stretched link
+

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

+ Go somewhere +
+
+{% endcapture %} +{% include example.html content=example %} + +Columns are relative by default, so if we want to stretch the link over a row, we need to add the `.position-static` class to column and add the `.position-relative` to the row. + +{% capture example %} +
+
+ {% include icons/placeholder.svg width="100%" height="200" class="w-100" text=" " title="Generic placeholder image" %} +
+
+
Columns with stretched link
+

Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. Donec lacinia congue felis in faucibus.

+ Go somewhere +
+
+{% endcapture %} +{% include example.html content=example %} + +Multiple links can be added to elements with a stretched link, but their `z-index` must be increased to be become clickable. + +{% capture example %} +
+ {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text=" " title="Card image cap" %} + +
+{% endcapture %} +{% include example.html content=example %} + +## Identifying the containing block + +If the stretched link doesn't seem to work, the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#Identifying_the_containing_block) will probably be the cause. The following CSS properties will make an element the containing block: + +- A `position` value other than `static` +- A `transform` or `perspective` value other than `none` +- A `will-change` value of `transform` or `perspective` +- A `filter` value other than `none` or a `will-change` value of `filter` (only works on Firefox) + +{% capture example %} +
+ {% include icons/placeholder.svg width="100%" height="180" class="card-img-top" text=" " title="Card image cap" %} +
+
Card with stretched links
+

Some quick example text to build on the card title and make up the bulk of the card's content.

+

+ Stretched link will not work here, because position: relative is added to the link +

+

+ This stretched link will only be spread over the p-tag, because a transform is applied to it. +

+
+
+{% endcapture %} +{% include example.html content=example %} From f50f6e03551ae9f9477f4ebdfe934c7452d6c6ad Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 10:15:52 -0800 Subject: [PATCH 02/56] Match .table-dark background-color to the -dark variable --- scss/_variables.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scss/_variables.scss b/scss/_variables.scss index 339c0d872b83..21e0fd935fbb 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -363,10 +363,10 @@ $table-border-color: $gray-300 !default; $table-head-bg: $gray-200 !default; $table-head-color: $gray-700 !default; -$table-dark-bg: $gray-900 !default; +$table-dark-bg: $gray-800 !default; $table-dark-accent-bg: rgba($white, .05) !default; $table-dark-hover-bg: rgba($white, .075) !default; -$table-dark-border-color: lighten($gray-900, 7.5%) !default; +$table-dark-border-color: lighten($table-dark-bg, 7.5%) !default; $table-dark-color: $white !default; $table-striped-order: odd !default; From 35caac013cef010da4c1b287dcfcd7ff23ffe541 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 20:14:05 +0100 Subject: [PATCH 03/56] Copy change Co-Authored-By: MartijnCuppens --- site/docs/4.1/utilities/stretched-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md index 53907ceee26d..992ec73fcecd 100644 --- a/site/docs/4.1/utilities/stretched-link.md +++ b/site/docs/4.1/utilities/stretched-link.md @@ -1,7 +1,7 @@ --- layout: docs title: Stretched link -description: Easily make an element which contains a stretched link clickable. +description: Make any HTML element or Bootstrap component clickable by "stretching" a nested link via CSS. group: utilities --- From abd5a5e4bd9cf73366b02fe2ceacb58464af17c4 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 20:14:42 +0100 Subject: [PATCH 04/56] Copy change Co-Authored-By: MartijnCuppens --- site/docs/4.1/utilities/stretched-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md index 992ec73fcecd..d394445e5e40 100644 --- a/site/docs/4.1/utilities/stretched-link.md +++ b/site/docs/4.1/utilities/stretched-link.md @@ -5,7 +5,7 @@ description: Make any HTML element or Bootstrap component clickable by "stretchi group: utilities --- -Adding the `.stretched-link` class to a link will make the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block) of the `::after` pseudo element of the link clickable. In most cases, this means that an element with `position: relative;` which contains a link with the `.stretched-link` class is clickable. +Add `.stretched-link` to a link to make it's [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block) clickable via a `::after` pseudo element. In most cases, this means that an element with `position: relative;` that contains a link with the `.stretched-link` class is clickable. Cards are relative by default, so in this case you can safely add the `.stretched-link` class to a link in the card. From 210d49ec05897e3354cc6a0d2873d8413f033ce8 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 20:15:03 +0100 Subject: [PATCH 05/56] Update site/docs/4.1/utilities/stretched-link.md Co-Authored-By: MartijnCuppens --- site/docs/4.1/utilities/stretched-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md index d394445e5e40..f58299816cb7 100644 --- a/site/docs/4.1/utilities/stretched-link.md +++ b/site/docs/4.1/utilities/stretched-link.md @@ -21,7 +21,7 @@ Cards are relative by default, so in this case you can safely add the `.stretche {% endcapture %} {% include example.html content=example %} -Media objects are not relative by default, we need to add the `.position-relative` here to prevent the link from stretching outside the media object. +Media objects do not have `position: relative` by default, so we need to add the `.position-relative` here to prevent the link from stretching outside the media object. {% capture example %}
From 470145bdcab0c16844111d16a5189a6b8cfc8ae4 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 20:17:45 +0100 Subject: [PATCH 06/56] Update site/docs/4.1/utilities/stretched-link.md Co-Authored-By: MartijnCuppens --- site/docs/4.1/utilities/stretched-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md index f58299816cb7..95224bb5b967 100644 --- a/site/docs/4.1/utilities/stretched-link.md +++ b/site/docs/4.1/utilities/stretched-link.md @@ -35,7 +35,7 @@ Media objects do not have `position: relative` by default, so we need to add the {% endcapture %} {% include example.html content=example %} -Columns are relative by default, so if we want to stretch the link over a row, we need to add the `.position-static` class to column and add the `.position-relative` to the row. +Columns are `position: relative` by default, so clickable columns only require the `.stretched-link` class on a link. However, stretching a link over an entire `.row` requires `.position-static` on the column and `.position-relative` on the row. {% capture example %}
From 236c7803cba37501580755dfe7a020fcf6aa0565 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 20:18:55 +0100 Subject: [PATCH 07/56] Update site/docs/4.1/utilities/stretched-link.md Co-Authored-By: MartijnCuppens --- site/docs/4.1/utilities/stretched-link.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/utilities/stretched-link.md b/site/docs/4.1/utilities/stretched-link.md index 95224bb5b967..c0c8940e10cb 100644 --- a/site/docs/4.1/utilities/stretched-link.md +++ b/site/docs/4.1/utilities/stretched-link.md @@ -7,7 +7,7 @@ group: utilities Add `.stretched-link` to a link to make it's [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block) clickable via a `::after` pseudo element. In most cases, this means that an element with `position: relative;` that contains a link with the `.stretched-link` class is clickable. -Cards are relative by default, so in this case you can safely add the `.stretched-link` class to a link in the card. +Cards have `position: relative` by default in Bootstrap, so in this case you can safely add the `.stretched-link` class to a link in the card without any other HTML changes. {% capture example %}
From 9d05cc25cb2d92bbfc26e616d5eaf426ae52df85 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 13:51:20 -0800 Subject: [PATCH 08/56] Fixes #26468: Mention min-height issue in IE10/11 for flexbox vertical alignment --- site/docs/4.1/layout/grid.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/docs/4.1/layout/grid.md b/site/docs/4.1/layout/grid.md index 1ee089381819..9311c544d756 100644 --- a/site/docs/4.1/layout/grid.md +++ b/site/docs/4.1/layout/grid.md @@ -340,7 +340,7 @@ Here's an example of customizing the Bootstrap grid at the large (`lg`) breakpoi ## Alignment -Use flexbox alignment utilities to vertically and horizontally align columns. +Use flexbox alignment utilities to vertically and horizontally align columns. **Internet Explorer 10-11 do not support vertical alignment of flex items when the flex container has a `min-height` as shown below.** [See Flexbugs #3 for more details.](https://github.com/philipwalton/flexbugs#flexbug-3) ### Vertical alignment From 3b42a9ec5be0425298a4a875ef6ae826242e1428 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 14:01:09 -0800 Subject: [PATCH 09/56] Add table-hover-color variables Fixes #26465 --- scss/_tables.scss | 2 ++ scss/_variables.scss | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scss/_tables.scss b/scss/_tables.scss index a1150420f172..bb9491b0b6cb 100644 --- a/scss/_tables.scss +++ b/scss/_tables.scss @@ -88,6 +88,7 @@ .table-hover { tbody tr { @include hover { + color: $table-hover-color; background-color: $table-hover-bg; } } @@ -152,6 +153,7 @@ &.table-hover { tbody tr { @include hover { + color: $table-dark-hover-color; background-color: $table-dark-hover-bg; } } diff --git a/scss/_variables.scss b/scss/_variables.scss index 339c0d872b83..0d4c19efd650 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -352,8 +352,10 @@ $hr-margin-y: $spacer !default; $table-cell-padding: .75rem !default; $table-cell-padding-sm: .3rem !default; +$table-color: $body-color !default; $table-bg: transparent !default; $table-accent-bg: rgba($black, .05) !default; +$table-hover-color: $table-color !default; $table-hover-bg: rgba($black, .075) !default; $table-active-bg: $table-hover-bg !default; @@ -363,11 +365,12 @@ $table-border-color: $gray-300 !default; $table-head-bg: $gray-200 !default; $table-head-color: $gray-700 !default; +$table-dark-color: $white !default; $table-dark-bg: $gray-900 !default; $table-dark-accent-bg: rgba($white, .05) !default; +$table-dark-hover-color: $table-dark-color !default; $table-dark-hover-bg: rgba($white, .075) !default; $table-dark-border-color: lighten($gray-900, 7.5%) !default; -$table-dark-color: $white !default; $table-striped-order: odd !default; From 4ad7ba7b23148d3813c8300c4e7631e520e272b5 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 15 Dec 2018 14:25:40 -0800 Subject: [PATCH 10/56] List out what's supported in validation styles Fixes #27169 --- site/docs/4.1/components/forms.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/site/docs/4.1/components/forms.md b/site/docs/4.1/components/forms.md index c47606647f7b..0026d33263c8 100644 --- a/site/docs/4.1/components/forms.md +++ b/site/docs/4.1/components/forms.md @@ -992,7 +992,13 @@ We recommend using client-side validation, but in case you require server-side v ### Supported elements -Our example forms show native textual ``s above, but form validation styles are also available for `