Skip to content

Commit

Permalink
Close calendar event popover when clicking outside it (#337)
Browse files Browse the repository at this point in the history
# References and relevant issues
Closes napari/napari-sphinx-theme#138, together with
napari/napari-sphinx-theme#147

# Description
Clicking outside of the calendar event modal or pressing the ESC key
closes the modal.

---------

Co-authored-by: Grzegorz Bokota <[email protected]>
  • Loading branch information
melissawm and Czaki authored Jan 31, 2024
1 parent 59b5f38 commit dac7042
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/community/meeting_schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,21 @@ If you are using napari or interested in how napari could be used in your work,
modal.style.display = "block";
var eventTitle = eventObj.title.charAt(0).toUpperCase() + eventObj.title.slice(1);
document.getElementById("details").innerHTML = '<b>' + eventTitle + '</b>' + '<br>' + eventObj.extendedProps.description;
//When the user clicks on <span> (x), close the modal
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
modal.onclick = function(event) {
if (event.target.id == "myModal") {
modal.style.display = "none";
}
}
window.addEventListener('keydown', function (event) {
if (event.key === 'Escape') {
modal.style.display = 'none'
}
})
},
eventDisplay: 'block',
});
Expand Down

0 comments on commit dac7042

Please sign in to comment.