From dd02f0f029c5914e09df47d47c328f66d0efcf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Thu, 11 Aug 2016 01:13:41 -0400 Subject: [PATCH] Make sure input height is reset when submitting with icon This is especially noticeable on mobile, where clicking Send icon is more natural. --- client/js/lounge.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 26656a4a..b0193469 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -631,6 +631,10 @@ $(function() { return false; }); + function resetInputHeight(input) { + input.style.height = input.style.minHeight; + } + var input = $("#input") .history() .on("input keyup", function() { @@ -638,7 +642,7 @@ $(function() { // Start by resetting height before computing as scrollHeight does not // decrease when deleting characters - this.style.height = this.style.minHeight; + resetInputHeight(this); this.style.height = Math.min( Math.round(window.innerHeight - 100), // prevent overflow @@ -662,6 +666,7 @@ $(function() { } input.val(""); + resetInputHeight(input.get(0)); if (text.indexOf("/clear") === 0) { clear();