From 4ecb44111d16048ef1ee3a7e96acb66ac9c39303 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Wed, 12 Oct 2022 12:39:49 +0200 Subject: Check if activeElement exists before using it According to MDN, document.activeElement can be null if there is no focused element. --- app/error-handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/error-handler.js b/app/error-handler.js index a68fe92..675bc51 100644 --- a/app/error-handler.js +++ b/app/error-handler.js @@ -53,7 +53,7 @@ function handleError(event, err) { // Remove focus from the currently focused element in order to // prevent keyboard interaction from continuing - document.activeElement.blur(); + if (document.activeElement) { document.activeElement.blur(); } // Don't let any element be focusable when showing the error let keyboardFocusable = 'a[href], button, input, textarea, select, details, [tabindex]'; -- cgit v1.2.1