Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the modal to close when we click outside the modal content #1897

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions assets/js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
qs(MODAL_CLOSE_BUTTON_SELECTOR).addEventListener('click', event => {
closeModal()
})

qs(MODAL_SELECTOR).addEventListener('click', event => {
const classList = event.target.classList
// if we clicked on the modal overlay/parent but not the modal content
if (classList.contains('modal') && classList.contains('shown') && classList.length === 2) {
closeModal()
}
})

Check failure on line 44 in assets/js/modal.js

View workflow job for this annotation

GitHub Actions / Check JS

Block must not be padded by blank lines

}

/**
Expand Down
Loading