-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
Popup and tooltip: dimensions in rem and bug fix of arrow placement #23820
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; |
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.
Line contains trailing whitespace
scss/_variables.scss
Outdated
|
||
$popover-arrow-width: 10px !default; | ||
$popover-arrow-height: 5px !default; | ||
$popover-arrow-width: .8rem !default; |
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.
Line contains trailing whitespace
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.875
should be written without a leading zero as .875
scss/_variables.scss
Outdated
@@ -608,40 +608,39 @@ $tooltip-max-width: 200px !default; | |||
$tooltip-color: $white !default; | |||
$tooltip-bg: $black !default; | |||
$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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.1875
should be written without a leading zero as .1875
scss/_tooltip.scss
Outdated
@@ -68,7 +71,7 @@ | |||
|
|||
.arrow::before { | |||
right: 0; | |||
margin-top: -($tooltip-arrow-width - 2); | |||
margin-top: $tooltip-arrow-margin; |
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.
Line contains trailing whitespace
scss/_tooltip.scss
Outdated
@@ -54,7 +57,7 @@ | |||
} | |||
|
|||
.arrow::before { | |||
margin-left: -($tooltip-arrow-width - 2); | |||
margin-left: $tooltip-arrow-margin; |
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.
Line contains trailing whitespace
scss/_tooltip.scss
Outdated
@@ -41,7 +44,7 @@ | |||
} | |||
|
|||
.arrow::before { | |||
margin-top: -($tooltip-arrow-width - 2); | |||
margin-top: $tooltip-arrow-margin; |
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.
Line contains trailing whitespace
scss/_tooltip.scss
Outdated
@@ -28,7 +31,7 @@ | |||
} | |||
|
|||
.arrow::before { | |||
margin-left: -($tooltip-arrow-width - 2); | |||
margin-left: $tooltip-arrow-margin; |
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.
Line contains trailing whitespace
scss/_tooltip.scss
Outdated
@@ -21,14 +22,16 @@ | |||
height: $tooltip-arrow-height; | |||
} | |||
|
|||
$tooltip-arrow-margin: -$tooltip-arrow-width/2; |
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.
$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
border-bottom-color: $popover-arrow-outer-color; | ||
} | ||
|
||
.arrow::after { | ||
top: -($popover-arrow-outer-width - 1); | ||
top: $popover-arrow-after-coor; |
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.
Line contains trailing whitespace
scss/_popover.scss
Outdated
@@ -106,17 +109,17 @@ | |||
|
|||
.arrow::before, | |||
.arrow::after { | |||
margin-left: -($popover-arrow-width - 3); | |||
margin-left: $popover-arrow-margin; |
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.
Line contains trailing whitespace
scss/_popover.scss
Outdated
border-top-color: $popover-arrow-outer-color; | ||
} | ||
|
||
.arrow::after { | ||
bottom: -($popover-arrow-outer-width - 1); | ||
margin-left: -($popover-arrow-outer-width - 5); | ||
bottom: $popover-arrow-after-coor; |
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.
Line contains trailing whitespace
scss/_popover.scss
Outdated
} | ||
|
||
.arrow::before { | ||
bottom: -$popover-arrow-outer-width; | ||
margin-left: -($popover-arrow-outer-width - 5); | ||
bottom: $popover-arrow-before-coor; |
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.
Line contains trailing whitespace
scss/_popover.scss
Outdated
@@ -39,17 +43,17 @@ | |||
|
|||
.arrow::before { | |||
content: ""; | |||
border-width: $popover-arrow-outer-width; | |||
border-width: $popover-arrow-width; |
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.
Line contains trailing whitespace
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable names should be followed immediately by a colon
scss/_popover.scss
Outdated
} | ||
|
||
$popover-arrow-margin: -$popover-arrow-width/2; |
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.
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}); |
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.
Line contains trailing whitespace
scss/_popover.scss
Outdated
@@ -25,10 +25,14 @@ | |||
.arrow { | |||
position: absolute; | |||
display: block; | |||
width: $popover-arrow-width; | |||
height: $popover-arrow-height; | |||
width: calc(2*#{$popover-border-width} + #{$popover-arrow-width}); |
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.
Line contains trailing whitespace
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