From 87f53b9cc9897772c84bdedc194009d4fd48aecf Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 26 Oct 2022 19:29:13 +0200 Subject: [PATCH] [JS] Avoid to trigger a commit event on 'ENTER' when the textfield is multiline --- src/display/annotation_layer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 1c7b738a3..495071dff 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1191,7 +1191,10 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { let commitKey = -1; if (event.key === "Escape") { commitKey = 0; - } else if (event.key === "Enter") { + } else if (event.key === "Enter" && !this.data.multiLine) { + // When we've a multiline field, "Enter" key is a key as the other + // hence we don't commit the data (Acrobat behaves the same way) + // (see issue #15627). commitKey = 2; } else if (event.key === "Tab") { commitKey = 3;