From 3abd4d6bffe3dc23c4ebbc526ac4f17370d71b21 Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Mon, 18 Oct 2021 15:27:44 +0200
Subject: [PATCH] moved item categories with no results in global search out of
 focus

---
 resources/assets/javascripts/lib/search.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/resources/assets/javascripts/lib/search.js b/resources/assets/javascripts/lib/search.js
index 38894f76d66..c059144862d 100644
--- a/resources/assets/javascripts/lib/search.js
+++ b/resources/assets/javascripts/lib/search.js
@@ -143,7 +143,8 @@ const Search = {
 
         $(`a#search_category_${name}`)
             .removeClass('no-result')
-            .text(`${value.name}  (${counter}${value.plus ? '+' : ''})`);
+            .text(`${value.name}  (${counter}${value.plus ? '+' : ''})`)
+            .attr('tabindex', '0');
 
         // We have more search results than shown, provide link to
         // full search if available.
@@ -326,7 +327,7 @@ const Search = {
      * Grey out all categories in the sidebar with no results.
      */
     greyOutSearchCategories: function () {
-        $('a[id^="search_category_"]').addClass('no-result');
+        $('a[id^="search_category_"]').addClass('no-result').attr('tabindex', '-1');
     },
 
     /**
@@ -371,6 +372,7 @@ const Search = {
             $('#show_all_categories').closest('li').addClass('active');
         } else {
             $(`#search_category_${category}`).closest('li').addClass('active');
+            $(`#search_category_${category}`).attr('tabindex', '0');
         }
         STUDIP.Search.showFilter(category);
 
-- 
GitLab