From ab92e48d2e2bca5d1b20f90c4e90b0e760c90088 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Wed, 25 Jul 2018 18:39:40 -0700 Subject: [PATCH] Fix auto resizing textareas scrolling to the top on focus --- data/interfaces/default/newsletter_config.html | 3 +++ data/interfaces/default/notifier_config.html | 3 +++ 2 files changed, 6 insertions(+) diff --git a/data/interfaces/default/newsletter_config.html b/data/interfaces/default/newsletter_config.html index 52d54f78..75df94cd 100644 --- a/data/interfaces/default/newsletter_config.html +++ b/data/interfaces/default/newsletter_config.html @@ -766,9 +766,12 @@ // auto resizing textarea for custom notification message body $('textarea[data-autoresize]').each(function () { + var modal_body = $(this).closest('.modal-body'); var offset = this.offsetHeight - this.clientHeight; var resizeTextarea = function (el) { + var modal_offset = modal_body.scrollTop(); $(el).css('height', 'auto').css('height', el.scrollHeight + offset); + modal_body.scrollTop(modal_offset); }; $(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize'); }); diff --git a/data/interfaces/default/notifier_config.html b/data/interfaces/default/notifier_config.html index f0a60430..7a164d0f 100644 --- a/data/interfaces/default/notifier_config.html +++ b/data/interfaces/default/notifier_config.html @@ -811,9 +811,12 @@ // auto resizing textarea for custom notification message body $('textarea[data-autoresize]').each(function () { + var modal_body = $(this).closest('.modal-body'); var offset = this.offsetHeight - this.clientHeight; var resizeTextarea = function (el) { + var modal_offset = modal_body.scrollTop(); $(el).css('height', 'auto').css('height', el.scrollHeight + offset); + modal_body.scrollTop(modal_offset); }; $(this).on('focus keyup input', function () { resizeTextarea(this); }).removeAttr('data-autoresize'); });