Skip to content

Commit 142e845

Browse files
authored
fix(material/tooltip): only expand hover area on side closest to trigger (#26786)
Fixes that we were adding an additional hover area on all sides of the tooltip, rather than only the side that is next to the trigger. Fixes #26557.
1 parent 76eeaaf commit 142e845

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/material/tooltip/tooltip.scss

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,32 @@
2626
&::before {
2727
$offset: -8px;
2828
content: '';
29-
top: $offset;
30-
right: $offset;
31-
bottom: $offset;
32-
left: $offset;
29+
top: 0;
30+
right: 0;
31+
bottom: 0;
32+
left: 0;
3333
z-index: -1;
3434
position: absolute;
35+
36+
// Only set the offset on the side closest to the panel so we
37+
// don't accidentally cover more content than we need to.
38+
.mat-mdc-tooltip-panel-below & {
39+
top: $offset;
40+
}
41+
42+
.mat-mdc-tooltip-panel-above & {
43+
bottom: $offset;
44+
}
45+
46+
// Note that here we use left/right instead of before/after
47+
// so that we don't have to add extra styles for RTL.
48+
.mat-mdc-tooltip-panel-right & {
49+
left: $offset;
50+
}
51+
52+
.mat-mdc-tooltip-panel-left & {
53+
right: $offset;
54+
}
3555
}
3656

3757
&._mat-animation-noopable {

0 commit comments

Comments
 (0)