Skip to content

Commit baa71d4

Browse files
Simplify shortcutsContainer check
Co-Authored-By: Stefan van der Walt <45071+stefanv@users.noreply.github.com>
1 parent 30464cc commit baa71d4

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

assets/js/shortcuts.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,13 @@ function setupShortcuts(shortcutDepth = 2) {
168168
const shortcuts = Array.from(
169169
document.querySelectorAll("#shortcuts div:not(#shortcuts-header)"),
170170
);
171-
if (shortcuts.length == 0) {
172-
const shortcutsContainer = document.getElementById("shortcuts-container");
173-
if (shortcutsContainer) {
171+
const shortcutsContainer = document.getElementById("shortcuts-container");
172+
173+
if (shortcutsContainer) {
174+
if (shortcuts.length == 0) {
174175
shortcutsContainer.style.display = "none";
175-
}
176-
} else {
177-
const shortcutsContainer = document.getElementById("shortcuts-container");
178-
if (shortcutsContainer && shortcutsContainer.style.display === "none") {
179-
shortcutsContainer.style.display = "";
176+
} else {
177+
shortcutsContainer.style.display = ""; // make shortcuts display visible, if hidden
180178
}
181179
}
182180

0 commit comments

Comments
 (0)