[Editor] Only focus the canvas for mouse events when drawing in the canvas

And if we've to focus it, we must prevent scrolling to avoid to draw at an
unexpected position.
This commit is contained in:
Calixte Denizet 2023-11-24 16:00:00 +01:00
parent d679078beb
commit 42147e8839

View File

@ -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);