Skip to content

Commit 86cdc26

Browse files
committed
In IE9-11, prevent breadcrumb separator from getting underlined on :hover when not using <ul> markup
Fixes #18733 in IE9-11 Also adds comments to the code explaining this and #18740.
1 parent a13c2e5 commit 86cdc26

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scss/_breadcrumb.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,29 @@
1010
.breadcrumb-item {
1111
float: left;
1212

13+
// The separator between breadcrumbs (by default, a forward-slash: "/")
1314
+ .breadcrumb-item::before {
14-
display: inline-block;
15+
display: inline-block; // Suppress underlining of the separator in modern browsers
1516
padding-right: $breadcrumb-item-padding;
1617
padding-left: $breadcrumb-item-padding;
1718
color: $breadcrumb-divider-color;
1819
content: "#{$breadcrumb-divider}";
1920
}
2021

22+
// When not using <ul> markup, browsers normally underline the ::before pseudo-element
23+
// (the separator between the breadcrumbs) when the user hovers over its originating breadcrumb <a> element.
24+
// In modern browsers, this underline can be suppressed by setting `display:inline-block` on the pseudo-element.
25+
// (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.)
26+
// IE9-11 suffer from a bug which prevents that solution from working.
27+
// 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.
28+
// This tricks IE into suppressing the underline.
29+
+ .breadcrumb-item:hover::before {
30+
text-decoration: underline; // Part 1 of IE9-11 hack to suppress the underline
31+
}
32+
+ .breadcrumb-item:hover::before {
33+
text-decoration: none; // Suppress underlining of the separator in IE9-11 (requires an earlier setting of `text-decoration:underline`)
34+
}
35+
2136
&.active {
2237
color: $breadcrumb-active-color;
2338
}

0 commit comments

Comments
 (0)