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

added geocoder.resetInput() to "methods" in README #133

Closed
wants to merge 1 commit into from
Closed

added geocoder.resetInput() to "methods" in README #133

wants to merge 1 commit into from

Conversation

Abbe98
Copy link

@Abbe98 Abbe98 commented Aug 4, 2016

No other of the mentioned method actually resets the input.

No other of the mentioned method actually resets the input.
@louh
Copy link
Contributor

louh commented Aug 7, 2016

Hi @Abbe98. Thanks for the PR! We didn't document certain methods because they were not designed with public use in mind (they can still change internally, for example). One of the side effects of resetInput I'm worried about is that it also puts focus on the input box, since it was designed to be called when a user clicks the reset (X) button in preparation for typing a new search. If you use resetInput() programmatically to reset the state of the geocoder, you might not be expecting that to happen.

Can you tell me more about your particular need to reset? Do you need to clear only the input element, or do you also need to reset other aspects of the geocoder (like the results list, for example)?

Thinking ahead, I think a better way to support a generic reset is to provide a new reset() method that is designed to be called programmatically and will actually fully reset the geocoder to a brand new state (while retaining current options). What do you think?

@Abbe98
Copy link
Author

Abbe98 commented Aug 7, 2016

I'm using it to clear the input, and the result list when a user has
selected a location so that the next time the geocoder is used the user can
start typing a new location without distraction(I'm also using it to
actually close the geocoder).

geocoder.on('select', function(e) {
   map.setZoom(13);
   geocoder.resetInput();
});

A new reset() method would work in my case.

2016-08-07 4:57 GMT+02:00 Lou Huang [email protected]:

Hi @Abbe98 https://github.com/Abbe98. Thanks for the PR! We didn't
document certain methods because they were not designed with public use in
mind (they can still change internally, for example). One of the side
effects of resetInput I'm worried about is that it also puts focus on the
input box, since it was designed to be called when a user clicks the reset
(X) button in preparation for typing a new search. If you use resetInput()
programmatically to reset the state of the geocoder, you might not be
expecting that to happen.

Can you tell me more about your particular need to reset? Do you need to
clear only the input element, or do you also need to reset other aspects of
the geocoder (like the results list, for example)?

Thinking ahead, I think a better way to support a generic reset is to
provide a new reset() method that is designed to be called
programmatically and will actually fully reset the geocoder to a brand new
state (while retaining current options). What do you think?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#133 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACgoJ6q5pc9cQ-n0wF4Z51lcJjHwUNuLks5qdUmsgaJpZM4JdHEb
.

@louh
Copy link
Contributor

louh commented Aug 9, 2016

I'm adding reset() in this commit: 7957055

@Abbe98
Copy link
Author

Abbe98 commented Aug 9, 2016

Thanks! 👍

@Abbe98 Abbe98 closed this Aug 9, 2016
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

Successfully merging this pull request may close these issues.

2 participants