Skip to content

Commit bdbd4af

Browse files
committed
Improved touch-friendliness of version selector on mobile
1 parent 6ce586c commit bdbd4af

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

material/assets/stylesheets/main.66ec5ba4.min.css

-2
This file was deleted.

material/assets/stylesheets/main.66ec5ba4.min.css.map

-1
This file was deleted.

material/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{% endif %}
4040
{% endblock %}
4141
{% block styles %}
42-
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.66ec5ba4.min.css' | url }}">
42+
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.875de78c.min.css' | url }}">
4343
{% if config.theme.palette %}
4444
{% set palette = config.theme.palette %}
4545
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.f1a3b89f.min.css' | url }}">

src/assets/stylesheets/main/layout/_source.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// ----------------------------------------------------------------------------
2626

2727
// Show repository facts
28-
@keyframes md-source__facts--done {
28+
@keyframes facts {
2929
0% {
3030
height: 0;
3131
}
@@ -36,7 +36,7 @@
3636
}
3737

3838
// Show repository fact
39-
@keyframes md-source__fact--done {
39+
@keyframes fact {
4040
0% {
4141
transform: translateY(100%);
4242
opacity: 0;
@@ -137,7 +137,7 @@
137137

138138
// Show after the data was loaded
139139
[data-md-state="done"] & {
140-
animation: md-source__facts--done 250ms ease-in;
140+
animation: facts 250ms ease-in;
141141
}
142142
}
143143

@@ -147,7 +147,7 @@
147147

148148
// Show after the data was loaded
149149
[data-md-state="done"] & {
150-
animation: md-source__fact--done 400ms ease-out;
150+
animation: fact 400ms ease-out;
151151
}
152152

153153
// Repository fact icon

src/assets/stylesheets/main/layout/_version.scss

+25
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
/// DEALINGS
2121
////
2222

23+
// ----------------------------------------------------------------------------
24+
// Keyframes
25+
// ----------------------------------------------------------------------------
26+
27+
// See https://github.com/squidfunk/mkdocs-material/issues/2429
28+
@keyframes hoverfix {
29+
0% {
30+
pointer-events: none;
31+
}
32+
}
33+
2334
// ----------------------------------------------------------------------------
2435
// Rules
2536
// ----------------------------------------------------------------------------
@@ -107,6 +118,20 @@
107118
max-height 0ms,
108119
opacity 250ms;
109120
}
121+
122+
// Fix hover on touch devices
123+
@media (pointer: coarse) {
124+
125+
// Switch off on hover
126+
.md-version:hover & {
127+
animation: hoverfix 250ms forwards;
128+
}
129+
130+
// Enable on focus
131+
.md-version:focus-within & {
132+
animation: none;
133+
}
134+
}
110135
}
111136

112137
// Version selection item

0 commit comments

Comments
 (0)