about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2025-03-22 18:04:54 +0100
committerAlan Pearce2025-03-22 18:04:54 +0100
commit03fa0eb00aef448bec05280a121c659a600fc13f (patch)
tree2d69b21e875007f410cc8ee709edff4dfdd7cb4c
parent4554d524916e48b18b4c669fe64bc8d54a148c59 (diff)
downloadsearchix-03fa0eb00aef448bec05280a121c659a600fc13f.tar.lz
searchix-03fa0eb00aef448bec05280a121c659a600fc13f.tar.zst
searchix-03fa0eb00aef448bec05280a121c659a600fc13f.zip
feat(js): allow opening details in new tab/window
-rw-r--r--frontend/static/search.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/frontend/static/search.js b/frontend/static/search.js
index 445a788..0bf4a5e 100644
--- a/frontend/static/search.js
+++ b/frontend/static/search.js
@@ -33,11 +33,13 @@ if (window.trustedTypes && trustedTypes.createPolicy) {
  * @param {MouseEvent} ev
  */
 function openSiblingDialog(ev) {
-  const dialog = ev.target.nextElementSibling;
-  dialog.showModal();
-  dialog.querySelector("button").addEventListener("click", function () {
-    dialog.close();
-  });
+  if (!(ev.shiftKey || ev.altKey || ev.ctrlKey || ev.metaKey)) {
+    const dialog = ev.target.nextElementSibling;
+    dialog.showModal();
+    dialog.querySelector("button").addEventListener("click", function () {
+      dialog.close();
+    });
+  }
 }
 
 /**
@@ -210,8 +212,10 @@ async function getDetail(url) {
  * @param {MouseEvent} ev
  */
 function handleDialogOpen(ev) {
-  getDetail(new URL(ev.target.href));
-  ev.preventDefault();
+  if (!(ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.altKey)) {
+    getDetail(new URL(ev.target.href));
+    ev.preventDefault();
+  }
 }
 
 if (state.opened.length > 0) {