Skip to content

Commit

Permalink
[Editor] Only focus the canvas for mouse events when drawing in the c…
Browse files Browse the repository at this point in the history
…anvas

And if we've to focus it, we must prevent scrolling to avoid to draw at an
unexpected position.
  • Loading branch information
calixteman committed Nov 24, 2023
1 parent d679078 commit 42147e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/display/editor/ink.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,13 @@ class InkEditor extends AnnotationEditor {

event.preventDefault();

if (event.type !== "mouse") {
this.div.focus();
if (
event.pointerType !== "mouse" &&
!this.div.contains(document.activeElement)
) {
this.div.focus({
preventScroll: true /* See issue #17327 */,
});
}

this.#startDrawing(event.offsetX, event.offsetY);
Expand Down

0 comments on commit 42147e8

Please sign in to comment.