Skip to content
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

Reset text/font properties more thoroughly for tooltips+popovers #16086

Merged
merged 3 commits into from
Apr 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions less/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
@import "mixins/responsive-visibility.less";
@import "mixins/size.less";
@import "mixins/tab-focus.less";
@import "mixins/reset-text.less";
@import "mixins/text-emphasis.less";
@import "mixins/text-overflow.less";
@import "mixins/vendor-prefixes.less";
Expand Down
18 changes: 18 additions & 0 deletions less/mixins/reset-text.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.reset-text() {
font-family: @font-family-base;
// We deliberately do NOT reset font-size.
font-style: normal;
font-weight: normal;
letter-spacing: normal;
line-break: auto;
line-height: @line-height-base;
text-align: left; // Fallback for where `start` is not supported
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
}
12 changes: 4 additions & 8 deletions less/popovers.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,18 @@
display: none;
max-width: @popover-max-width;
padding: 1px;
// Reset font and text properties given new insertion method
font-family: @font-family-base;
// Our parent element can be arbitrary since popovers are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
.reset-text();
font-size: @font-size-base;
font-weight: normal;
line-height: @line-height-base;
text-align: left;

background-color: @popover-bg;
background-clip: padding-box;
border: 1px solid @popover-fallback-border-color;
border: 1px solid @popover-border-color;
border-radius: @border-radius-large;
.box-shadow(0 5px 10px rgba(0,0,0,.2));

// Overrides for proper insertion
white-space: normal;

// Offset the popover to account for the popover arrow
&.top { margin-top: -@popover-arrow-width; }
&.right { margin-left: @popover-arrow-width; }
Expand Down
9 changes: 4 additions & 5 deletions less/tooltip.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
position: absolute;
z-index: @zindex-tooltip;
display: block;
// Reset font and text properties given new insertion method
font-family: @font-family-base;
// Our parent element can be arbitrary since tooltips are by default inserted as a sibling of their target element.
// So reset our font and text properties to avoid inheriting weird values.
.reset-text();
font-size: @font-size-small;
font-weight: normal;
line-height: 1.4;

.opacity(0);

&.in { .opacity(@tooltip-opacity); }
Expand All @@ -28,7 +28,6 @@
padding: 3px 8px;
color: @tooltip-color;
text-align: center;
text-decoration: none;
background-color: @tooltip-bg;
border-radius: @border-radius-base;
}
Expand Down