From 68076af0e46aed46de40a469c44af4979e6cf31c Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 11 Jul 2024 18:48:52 +0200 Subject: [PATCH] [Editor] Avoid error when an editor is unselected during the pdf.js closing It aims to fix an error I noticed in the logs: JavaScript error: http://127.0.0.1:65159/build/generic/build/pdf.mjs, line 15847: TypeError: can't access property "div", currentLayer is undefined --- src/display/editor/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display/editor/editor.js b/src/display/editor/editor.js index 69dee6f15cfb7..43a8f8d21ddec 100644 --- a/src/display/editor/editor.js +++ b/src/display/editor/editor.js @@ -1581,7 +1581,7 @@ class AnnotationEditor { if (this.div?.contains(document.activeElement)) { // Don't use this.div.blur() because we don't know where the focus will // go. - this._uiManager.currentLayer.div.focus({ + this.currentLayer?.div.focus({ preventScroll: true, }); }