question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional ESC key popup close

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cherniavskiicommented, Sep 23, 2017

Looks like issue can be closed now 😉

0reactions
Mickyfen17commented, Aug 23, 2017

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 no esc 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 the esc via the popup. Hope this all makes sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reactive popup close by esc key - OutSystems
There is no default option to close the reactive popup by pressing the esc key. You need to create event for the popup...
Read more >
ESC kep to close the pop up form - Stack Overflow
I found a code online which helps me close pop up dialog using ESC button. The code is as follows: <script type="text/javascript"> function ......
Read more >
Prevent Popup close on ESC key | General Discussion | Wijmo 5
If you want the popup to close only programmatically, then you can handle the hiding event and cancel the popup hiding event to...
Read more >
ESC key causing model to close - Mendix Forum
Hi All, I have a scenario where modal should not be closed when user presses escape key.. I tried disabling the esc key...
Read more >
Javascript: Close a model with 'Escape' key - SitePoint
Hello, I'm struggling to get my head around how to close a modal with the escape key. I've looked at so many solutions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found