From 50871fb1c2ea40847b6ffeb451f10e67c8a2f1bc Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Tue, 25 Jan 2022 16:17:01 +0000
Subject: [PATCH] fix for BIESt #583

---
 resources/assets/javascripts/lib/skip_links.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/resources/assets/javascripts/lib/skip_links.js b/resources/assets/javascripts/lib/skip_links.js
index c37af9eeef0..1a4a9d0c98d 100644
--- a/resources/assets/javascripts/lib/skip_links.js
+++ b/resources/assets/javascripts/lib/skip_links.js
@@ -79,9 +79,14 @@ const SkipLinks = {
             SkipLinks.moveSkipLinkNavigationOut();
             jQuery('.focus_box').removeClass('focus_box');
             jQuery(fragment).addClass('focus_box');
-            jQuery(fragment)
-                .click()
-                .focus();
+            if (jQuery(fragment).is(':focusable')) {
+                jQuery(fragment)
+                    .click()
+                    .focus();
+            } else {
+                //Set the focus on the first focusable element:
+                jQuery(fragment).find(':focusable').eq(0).focus();
+            }
             SkipLinks.activeElement = fragment;
             return true;
         } else {
-- 
GitLab