Check if activeElement exists before using it

According to MDN, document.activeElement can be null if there is no
focused element.
This commit is contained in:
Samuel Mannehed 2022-10-12 12:39:49 +02:00
parent bdc0bbbb4f
commit 4ecb44111d
1 changed files with 1 additions and 1 deletions

View File

@ -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]';