From ea5b42d9950e7d76f985e3810d35889bca9a765a Mon Sep 17 00:00:00 2001 From: "Tobias H. Petersen" Date: Sat, 16 Dec 2023 17:44:15 +0100 Subject: [PATCH] add tabindex to search results enabling selection through tab + enable opening selected result using return --- js/script.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/js/script.js b/js/script.js index 413ad36..1c8e958 100644 --- a/js/script.js +++ b/js/script.js @@ -83,10 +83,19 @@ var updateOptionsTable = function(options) { att1.value = "optrow"; tableRow.setAttributeNode(att1); + var att2 = document.createAttribute("tabindex"); + att2.value = "0"; + tableRow.setAttributeNode(att2); - var att2 = document.createAttribute("style"); - att2.value = "overflow-wrap: break-word"; - titleColumn.setAttributeNode(att2); + tableRow.onkeydown = function(e) { + if (e.keyCode == 13) { + tableRow.click(); + }; + }; + + var att3 = document.createAttribute("style"); + att3.value = "overflow-wrap: break-word"; + titleColumn.setAttributeNode(att3); tableRow.appendChild(titleColumn); tableRow.appendChild(descriptionColumn);