Tooltips and popovers still inherit `font-style` and others
Created by: natevw
In Bootstrap v3.3.1 many of the font settings were properly reset for tooltip/popover content via https://github.com/twbs/bootstrap/commit/2862c30320e8a1c0499f4bd83141e0c6cd959f1e. I'm glad the decision was made in this direction, to reset font/text back to defaults within the content — but the implementation was incomplete. For example, we noticed already that a popover within font-style: italic
text has its contents still italic. So https://github.com/twbs/bootstrap/issues/15046 does not seem fully resolved yet.
In case it's helpful, here's a LESS snippet (including a link that could lead you to a relevant reference) that I used for resetting fonts in a non-Bootstrap project:
.reset-text(@fontsize) { // used to avoid unwanted inheritance of text-related styles from a parent
// most of this list is based on properties first-line applies to [NOTE: hasn't been exhaustively reviewed]
// see https://developer.mozilla.org/en-US/docs/Web/CSS/::first-line (and W3C spec) for more details
font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;
font-size: @fontsize;
// font, font-family omitted
color: black;
word-spacing: normal; letter-spacing: normal; text-decoration: none; text-transform: none;
text-shadow: none;
// some other properties added in as well
text-indent: 0;
text-align: left; text-align: start;
}
Note that the snippet above is not exhaustive (it likely covers only the properties we used/anticipated in this particular app and/or predates more properties being added to the spec) but hopefully a more thorough start — not to mention perhaps the idea to encapsulate all the reset in a reusable LESS mixin is valuable.