From f26dadb0c13e0938d197dcd262a381d990cbd734 Mon Sep 17 00:00:00 2001 From: Jared McAteer Date: Sat, 6 Oct 2018 14:32:11 -0600 Subject: [PATCH] Focus existing comment reply box if one exists --- tildes/static/js/behaviors/comment-reply-button.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tildes/static/js/behaviors/comment-reply-button.js b/tildes/static/js/behaviors/comment-reply-button.js index 016a0b9..d3e4905 100644 --- a/tildes/static/js/behaviors/comment-reply-button.js +++ b/tildes/static/js/behaviors/comment-reply-button.js @@ -25,6 +25,11 @@ $.onmount('[data-js-comment-reply-button]', function() { var postURL = '/api/web/comments/' + parentCommentID + '/replies'; var markdownID = 'markdown-reply-' + parentCommentID; + if ($('#' + markdownID).length > 0) { + $('#' + markdownID).focus(); + return; + } + var replyForm = document.createElement('form'); replyForm.setAttribute('method', 'post'); replyForm.setAttribute('autocomplete', 'off');