Skip to content

Commit 8569bd0

Browse files
committed
Make the help visible in all the themes of mdbook
Also handle the ? key with or without shift being pressed.
1 parent 8184342 commit 8569bd0

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/front-end/css/general.css

+7
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ sup {
288288
right: 0;
289289
bottom: 0;
290290
background-color: rgba(225,225,225,1);
291+
color: black;
291292
z-index: 2;
292293
cursor: pointer;
293294
border-width: 3px;
@@ -297,6 +298,12 @@ sup {
297298

298299
padding: 10px;
299300
}
301+
#help-overlay kbd {
302+
border-width: 1px;
303+
border-color: black;
304+
border-style: solid;
305+
background-color: white;
306+
}
300307
#help-title {
301308
text-align: center;
302309
}

src/front-end/js/book.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -668,14 +668,16 @@ aria-label="Show hidden lines"></button>';
668668
document.getElementById("help-overlay").style.display = "none";
669669
}
670670

671-
if (e.shiftKey) {
672-
switch (e.key) {
673-
case '?':
674-
e.preventDefault();
675-
showHelp();
676-
break;
677-
}
671+
// Usually needs the Shift key to be pressed
672+
switch (e.key) {
673+
case '?':
674+
e.preventDefault();
675+
showHelp();
676+
break;
677+
}
678678

679+
// Rest of the keys are only active when the Shift key is not pressed
680+
if (e.shiftKey) {
679681
return;
680682
}
681683

0 commit comments

Comments
 (0)