Optional ESC key popup close
See original GitHub issueI came across a scenario with the default functionality on the esc
key for popups. Inside of our popup we have an image gallery which can be made fullscreen.
The issue that I came across was when the image gallery is fullscreen and the user presses the esc
key, the popup will close from behind the image gallery also closing the gallery itself. This taking the user back to the map.
I checked out that docs and couldn’t pinpoint a way to disable this default functionality (unless I’ve missed it) so to get around this I just removed the default map.closePopup();
method on our application.
I was wondering if this default esc
key functionality could become optional? Set to true
as default.
By adding and a key escKeyClose
within the options object and modifying this conditional.
It was a fairly straight forward process to replicate the above modification locally in our app.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Looks like issue can be closed now 😉
The popup shows on the click of a map marker, within the popup we have an image gallery, that image gallery can be made full screen. When it’s made fullscreen the popup still exists on the DOM, which includes the default
esc
closePopup
function. Thats where my issue lies, there is noesc
event attached to the image gallery so if the user does click that key expecting the image gallery to close, it will instead close the popup where the image gallery is rendered from, taking the user back to the map. I don’t want to remove the popup from the DOM when the images are fullscreen as the user should still see the popup once the fullscreen image gallery is closed. Which is the reason I have disabled the default function attached to theesc
via the popup. Hope this all makes sense.