summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2022-10-12 12:39:49 +0200
committerSamuel Mannehed <samuel@cendio.se>2022-10-12 12:39:49 +0200
commit4ecb44111d16048ef1ee3a7e96acb66ac9c39303 (patch)
tree3c003f57242076104af7ddfab3d5e4b2e516fd0f
parentbdc0bbbb4fd8cd6c5471efd53e343ceb93a63ec3 (diff)
downloadnovnc-4ecb44111d16048ef1ee3a7e96acb66ac9c39303.tar.gz
Check if activeElement exists before using it
According to MDN, document.activeElement can be null if there is no focused element.
-rw-r--r--app/error-handler.js2
1 files changed, 1 insertions, 1 deletions
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]';