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

Pressing enter in the search box submits form #1

Open
lordelph opened this issue Aug 11, 2022 · 0 comments
Open

Pressing enter in the search box submits form #1

lordelph opened this issue Aug 11, 2022 · 0 comments

Comments

@lordelph
Copy link

lordelph commented Aug 11, 2022

I've got leaflet + leaflet search embedded within a larger form
When I press enter to complete a search in the map, the form is submitted

I've got this to prevent the enter 'keydown' from bubbling up

 $('.map-container').keydown(function(event){
           if(event.keyCode == 13) {
               event.stopPropagation();
               return false;
           }
       });
       

But this seems to interfere with the search - when I press enter,nothing happens until I click outside of the search, and the map is centered on the search result location.

Is there a recommended way to use this plugin when the leaflet div is within a form?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant