sqzass.git

sqzass

~ static site generator in Rust
git clone https://github.com/debuman/sqzass.git
commit 1c0ca27f86f24c2327e4839ed2905fe31522e953
parent b13b9938ace09f7bf9e73f4a767c8febb70f8d06
Author: sqzer <110329244+sqzer-x@users.noreply.github.com>
Date: Sat, 25 Jul 2026 21:51:25 +0900

Open search with Ctrl/⌘+/ instead

Requested, and it gives Save Page back — Ctrl+/ collides with nothing the
browser does, so the palette no longer has to take a shortcut away to get one.

Matched on e.key, not e.code: on layouts where the slash sits behind Shift the
physical key is elsewhere, and what the reader typed is what should count.
Ctrl+Shift+/ therefore opens it too, which is what those keyboards produce.

Diffstat:
Mdocs/static/js/search.js | 10+++++-----
Mdocs/templates/base.html | 2+-
2 files changed, 6 insertion(+), 6 deletion(-)

diff --git a/docs/static/js/search.js b/docs/static/js/search.js
@@ -174,11 +174,11 @@
 
   trigger.addEventListener("click", open);
 
-  /* Ctrl/⌘+S. This takes the shortcut away from the browser's Save Page,
-     deliberately: on a documentation site nobody is saving the HTML, and the
-     key is the one people already reach for. */
+  /* Ctrl/⌘+/. Matched on e.key rather than e.code, because on the layouts
+     where the slash needs a modifier of its own the physical key is somewhere
+     else entirely — what the reader typed is what matters, not where. */
   document.addEventListener("keydown", function (e) {
-    if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s") {
+    if ((e.metaKey || e.ctrlKey) && e.key === "/") {
       e.preventDefault();
       dialog.open ? dialog.close() : open();
     }
@@ -205,5 +205,5 @@
   /* The shortcut hint is written here, not in the template, because it is a
      property of the reader's keyboard rather than of the page. */
   var mac = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
-  trigger.querySelector("kbd").textContent = mac ? "⌘S" : "Ctrl S";
+  trigger.querySelector("kbd").textContent = mac ? "⌘/" : "Ctrl /";
 })();
diff --git a/docs/templates/base.html b/docs/templates/base.html
@@ -48,7 +48,7 @@
             data-index="/search-{{ page.language }}.json">
       {#- The label is replaced with the reader's own modifier by search.js;
           this is the value someone with JavaScript off sees. #}
-      <span>{{ "검색" if ko else "Search" }}</span><kbd>Ctrl S</kbd>
+      <span>{{ "검색" if ko else "Search" }}</span><kbd>Ctrl /</kbd>
     </button>
     {%- for t in page.translations %}
     <a href="{{ t.url }}" hreflang="{{ t.code }}">{{ t.name }}</a>