Skip to content

Commit 42bee3a

Browse files
committed
fix: add hover bridge to tooltips for smoother user experience (#144)
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
1 parent 596aa93 commit 42bee3a

5 files changed

Lines changed: 72 additions & 4 deletions

File tree

dist/assets/stylesheets/classic/main.dc9b4186.min.css renamed to dist/assets/stylesheets/classic/main.82a87433.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/stylesheets/modern/main.1ebfa1a4.min.css renamed to dist/assets/stylesheets/modern/main.19d3147f.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
{% endblock %}
4848
{% block styles %}
4949
{% if config.theme.variant == "modern" %}
50-
{% set href = 'assets/stylesheets/modern/main.1ebfa1a4.min.css' | url %}
50+
{% set href = 'assets/stylesheets/modern/main.19d3147f.min.css' | url %}
5151
{% else %}
52-
{% set href = 'assets/stylesheets/classic/main.dc9b4186.min.css' | url %}
52+
{% set href = 'assets/stylesheets/classic/main.82a87433.min.css' | url %}
5353
{% endif %}
5454
<link rel="stylesheet" href="{{ href }}">
5555
{% if config.theme.palette %}

src/assets/stylesheets/classic/main/components/_tooltip2.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,40 @@
110110
border-bottom: var(--md-tooltip-tail) solid var(--md-default-bg-color);
111111
}
112112

113+
// Hover bridge for interactive tooltips to span the visual gap to the host
114+
&[role="dialog"]::after {
115+
position: absolute;
116+
left:
117+
clamp(
118+
#{px2rem(16px)},
119+
calc(
120+
var(--md-tooltip-host-x) -
121+
#{px2rem(16px)}
122+
),
123+
calc(
124+
100vw -
125+
var(--md-tooltip-width) -
126+
#{px2rem(16px)}
127+
)
128+
);
129+
z-index: 1;
130+
display: block;
131+
width: var(--md-tooltip-width);
132+
height: px2rem(16px);
133+
content: "";
134+
pointer-events: auto;
135+
}
136+
137+
// Hover bridge if rendered above target
138+
&[role="dialog"].md-tooltip2--top::after {
139+
top: 100%;
140+
}
141+
142+
// Hover bridge if rendered below target
143+
&[role="dialog"].md-tooltip2--bottom::after {
144+
bottom: 100%;
145+
}
146+
113147
// Tooltip is visible
114148
&--active {
115149
z-index: 4;

src/assets/stylesheets/modern/main/components/_tooltip2.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,40 @@
110110
border-bottom: var(--md-tooltip-tail) solid var(--md-default-bg-color);
111111
}
112112

113+
// Hover bridge for interactive tooltips to span the visual gap to the host
114+
&[role="dialog"]::after {
115+
position: absolute;
116+
left:
117+
clamp(
118+
#{px2rem(16px)},
119+
calc(
120+
var(--md-tooltip-host-x) -
121+
#{px2rem(16px)}
122+
),
123+
calc(
124+
100vw -
125+
var(--md-tooltip-width) -
126+
#{px2rem(16px)}
127+
)
128+
);
129+
z-index: 1;
130+
display: block;
131+
width: var(--md-tooltip-width);
132+
height: px2rem(16px);
133+
content: "";
134+
pointer-events: auto;
135+
}
136+
137+
// Hover bridge if rendered above target
138+
&[role="dialog"].md-tooltip2--top::after {
139+
top: 100%;
140+
}
141+
142+
// Hover bridge if rendered below target
143+
&[role="dialog"].md-tooltip2--bottom::after {
144+
bottom: 100%;
145+
}
146+
113147
// Tooltip is visible
114148
&--active {
115149
z-index: 4;

0 commit comments

Comments
 (0)