From b6c0baf44d7d737ede7784848374a8af3e911ac1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 7 Oct 2019 20:21:04 +0100 Subject: [PATCH] Updated comment delete action to be a button Fixes issue that causes code error when an anchor tag. Closes #1650 --- resources/assets/js/components/page-comments.js | 2 ++ resources/views/comments/comment.blade.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/page-comments.js b/resources/assets/js/components/page-comments.js index cabce9139..5d8d16958 100644 --- a/resources/assets/js/components/page-comments.js +++ b/resources/assets/js/components/page-comments.js @@ -26,10 +26,12 @@ class PageComments { handleAction(event) { let actionElem = event.target.closest('[action]'); + if (event.target.matches('a[href^="#"]')) { const id = event.target.href.split('#')[1]; scrollAndHighlightElement(document.querySelector('#' + id)); } + if (actionElem === null) return; event.preventDefault(); diff --git a/resources/views/comments/comment.blade.php b/resources/views/comments/comment.blade.php index 5fbdfa500..ea96a9250 100644 --- a/resources/views/comments/comment.blade.php +++ b/resources/views/comments/comment.blade.php @@ -31,7 +31,7 @@ @endif