Skip to content

Commit

Permalink
fix(#230): Fix closing of anonymous create comment modal
Browse files Browse the repository at this point in the history
- the issue occured if and when the modal wasn't active and the hideModal was called to close it.
  • Loading branch information
abhiabhi94 authored and Radi85 committed Sep 5, 2021
1 parent 8c6c3a0 commit f8942bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions comment/static/js/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,21 @@ document.addEventListener('DOMContentLoaded', () => {
};

let showModal = modalElement => {
if (!modalElement) return;
modalElement.style.display = 'block';
setTimeout(() => {
modalElement.classList.add('show-modal');
}, 20);
};

let hideModal = modalElement => {
if (!modalElement) return;
modalElement.classList.remove('show-modal');
modalElement.style.display = 'none';
};

let hideCreateAnonymousCommentModal = () => {
if (!createAnonymousCommentModal) return;
let form = createAnonymousCommentModal.querySelector('.modal-body').querySelector('form');
if (form) {
createAnonymousCommentModal.querySelector('.modal-body').removeChild(form);
Expand Down

0 comments on commit f8942bf

Please sign in to comment.