This is the first time I see this accessibility issue, pressing the "Down" key (▼) doesn't work to navigate the page (scroll down) and instead goes all the way to the top.
function closeModal() {
let modal = document.getElementById("myModal");
modal.style.display = "none";
window.location.hash = '';
}
// Left and right arrow keys scrub through the gallery.
// Everything else closes the modal.
document.onkeydown = function (e) {
if (e.keyCode === 37) {
// Left arrow
goBackPrevImage();
} else if (e.keyCode === 39) {
// Right arrow
advanceNextImage();
} else {
closeModal();
}
};