]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
In IE9-11, prevent breadcrumb separator from getting underlined on :hover when not... 18789/head
authorChris Rebert <code@chrisrebert.com>
Thu, 7 Jan 2016 02:34:28 +0000 (18:34 -0800)
committerChris Rebert <code@chrisrebert.com>
Thu, 7 Jan 2016 08:43:35 +0000 (00:43 -0800)
Fixes #18733 in IE9-11
Also adds comments to the code explaining this and #18740.

scss/_breadcrumb.scss

index 6fb812d1cca76fa4314f476937c6d084538fe19e..d5fba04a40659fe0cc34ac1b1a0f7ff862e12899 100644 (file)
 .breadcrumb-item {
   float: left;
 
+  // The separator between breadcrumbs (by default, a forward-slash: "/")
   + .breadcrumb-item::before {
-    display: inline-block;
+    display: inline-block; // Suppress underlining of the separator in modern browsers
     padding-right: $breadcrumb-item-padding;
     padding-left: $breadcrumb-item-padding;
     color: $breadcrumb-divider-color;
     content: "#{$breadcrumb-divider}";
   }
 
+  // When not using <ul> markup, browsers normally underline the ::before pseudo-element
+  // (the separator between the breadcrumbs) when the user hovers over its originating breadcrumb <a> element.
+  // In modern browsers, this underline can be suppressed by setting `display:inline-block` on the pseudo-element.
+  // (Why doesn't simply setting `text-decoration:none` on the pseudo-element work? Because that's how text-decoration propagation has been spec'd in CSS.)
+  // IE9-11 suffer from a bug which prevents that solution from working.
+  // For them, we apply a hack where we first set `text-decoration:underline` and then later set `text-decoration:none`, both on the pseudo-element.
+  // This tricks IE into suppressing the underline.
+  + .breadcrumb-item:hover::before {
+    text-decoration: underline; // Part 1 of IE9-11 hack to suppress the underline
+  }
+  + .breadcrumb-item:hover::before {
+    text-decoration: none; // Suppress underlining of the separator in IE9-11 (requires an earlier setting of `text-decoration:underline`)
+  }
+
   &.active {
     color: $breadcrumb-active-color;
   }