Popup and tooltip: dimensions in rem and bug fix of arrow placement#23820
Popup and tooltip: dimensions in rem and bug fix of arrow placement#23820NielsHolt wants to merge 11 commits intotwbs:v4-devfrom
Conversation
Allows for arrow-width in rem
Allows for arrow-width in rem
… popup-in-rem # Conflicts: # scss/_variables.scss
Fix error on arrow margin to center arrow on element
scss/_variables.scss
Outdated
| $popover-arrow-width: 10px !default; | ||
| $popover-arrow-height: 5px !default; | ||
| $popover-arrow-width: .8rem !default; | ||
| $popover-arrow-height: .4rem !default; |
scss/_variables.scss
Outdated
|
|
||
| $popover-arrow-width: 10px !default; | ||
| $popover-arrow-height: 5px !default; | ||
| $popover-arrow-width: .8rem !default; |
scss/_variables.scss
Outdated
| $popover-body-padding-y: 9px !default; | ||
| $popover-body-padding-x: 14px !default; | ||
| $popover-body-padding-y: 0.5625rem !default; | ||
| $popover-body-padding-x: 0.875rem !default; |
There was a problem hiding this comment.
0.875 should be written without a leading zero as .875
scss/_variables.scss
Outdated
| $popover-body-color: $body-color !default; | ||
| $popover-body-padding-y: 9px !default; | ||
| $popover-body-padding-x: 14px !default; | ||
| $popover-body-padding-y: 0.5625rem !default; |
There was a problem hiding this comment.
0.5625 should be written without a leading zero as .5625
scss/_variables.scss
Outdated
| $popover-header-padding-y: 8px !default; | ||
| $popover-header-padding-x: 14px !default; | ||
| $popover-header-padding-y: 0.5rem !default; | ||
| $popover-header-padding-x: 0.875rem !default; |
There was a problem hiding this comment.
0.875 should be written without a leading zero as .875
scss/_variables.scss
Outdated
| $tooltip-opacity: .9 !default; | ||
| $tooltip-padding-y: 3px !default; | ||
| $tooltip-padding-x: 8px !default; | ||
| $tooltip-padding-y: 0.1875rem !default; |
There was a problem hiding this comment.
0.1875 should be written without a leading zero as .1875
scss/_tooltip.scss
Outdated
| .arrow::before { | ||
| right: 0; | ||
| margin-top: -($tooltip-arrow-width - 2); | ||
| margin-top: $tooltip-arrow-margin; |
scss/_tooltip.scss
Outdated
|
|
||
| .arrow::before { | ||
| margin-left: -($tooltip-arrow-width - 2); | ||
| margin-left: $tooltip-arrow-margin; |
scss/_tooltip.scss
Outdated
|
|
||
| .arrow::before { | ||
| margin-top: -($tooltip-arrow-width - 2); | ||
| margin-top: $tooltip-arrow-margin; |
scss/_tooltip.scss
Outdated
|
|
||
| .arrow::before { | ||
| margin-left: -($tooltip-arrow-width - 2); | ||
| margin-left: $tooltip-arrow-margin; |
scss/_tooltip.scss
Outdated
| height: $tooltip-arrow-height; | ||
| } | ||
|
|
||
| $tooltip-arrow-margin: -$tooltip-arrow-width/2; |
There was a problem hiding this comment.
$tooltip-arrow-width/2 should be written with a single space on each side of the operator: $tooltip-arrow-width / 2
scss/_popover.scss
Outdated
|
|
||
| .arrow::after { | ||
| top: -($popover-arrow-outer-width - 1); | ||
| top: $popover-arrow-after-coor; |
scss/_popover.scss
Outdated
| .arrow::before, | ||
| .arrow::after { | ||
| margin-left: -($popover-arrow-width - 3); | ||
| margin-left: $popover-arrow-margin; |
scss/_popover.scss
Outdated
| .arrow::after { | ||
| bottom: -($popover-arrow-outer-width - 1); | ||
| margin-left: -($popover-arrow-outer-width - 5); | ||
| bottom: $popover-arrow-after-coor; |
scss/_popover.scss
Outdated
| .arrow::before { | ||
| bottom: -$popover-arrow-outer-width; | ||
| margin-left: -($popover-arrow-outer-width - 5); | ||
| bottom: $popover-arrow-before-coor; |
scss/_popover.scss
Outdated
| .arrow::before { | ||
| content: ""; | ||
| border-width: $popover-arrow-outer-width; | ||
| border-width: $popover-arrow-width; |
scss/_popover.scss
Outdated
|
|
||
| $popover-arrow-margin: -$popover-arrow-width/2; | ||
| $popover-arrow-before-coor: calc(-#{$popover-arrow-width} - #{$popover-border-width}); | ||
| $popover-arrow-after-coor : -$popover-arrow-width; |
There was a problem hiding this comment.
Variable names should be followed immediately by a colon
scss/_popover.scss
Outdated
| height: calc(2*#{$popover-border-width} + #{$popover-arrow-height}); | ||
| } | ||
|
|
||
| $popover-arrow-margin: -$popover-arrow-width/2; |
There was a problem hiding this comment.
Line contains trailing whitespace$popover-arrow-width/2 should be written with a single space on each side of the operator: $popover-arrow-width / 2
scss/_popover.scss
Outdated
| width: $popover-arrow-width; | ||
| height: $popover-arrow-height; | ||
| width: calc(2*#{$popover-border-width} + #{$popover-arrow-width}); | ||
| height: calc(2*#{$popover-border-width} + #{$popover-arrow-height}); |
scss/_popover.scss
Outdated
| display: block; | ||
| width: $popover-arrow-width; | ||
| height: $popover-arrow-height; | ||
| width: calc(2*#{$popover-border-width} + #{$popover-arrow-width}); |
|
is it possible to have a live example on a Codepen ? |
|
@Johann-S - I put some images in my original comment. I haven't used CodePen before but I give it a try (but it may take a while) |
|
Hi @Johann-S |
|
Sorry - closed by mistake |
|
@NielsHolt |
|
Ups - was closed by mistake. Reopened with updated demo |
|
Not a fan of this approach, thanks though! |
Hi


This PR will change the dimensions of popover and tooltip from px to rem AND fix a bug in the way the arrow of popover and tooltips are placed. The current placement of the arrow is only centered on the element when border-width and arrow-width are default values. This PR will allow both border-width and arrow-width to be changed
It need to be merged/integrated with #23763
Could solve #23793 and issues in #23468
Setting
$border-width: 20px; $popover-border-width:10px;in Bootstrap 4-beta would giveIn this PR (with
$popover-arrow-width: 1rem;) it would be