leaflet-geosearch
leaflet-geosearch copied to clipboard
Close search button with x
This PR adds behavior to the clear text "x" button while the geosearch is in button
mode. If there is no text in the search input, the "x" button will additionally close the search input, exactly as if the primary search button itself was clicked. If there is text in in the search input, the button will behave as before, clearing the text but not closing the button.
As is, this PR does not make this behavior configurable. There are two reasons for this decision:
- There is no existing behavior being overwritten with this change, as clicking the "x" without any text is effective a no-op.
- There is little reason for a user to click the "x" if the text is already cleared. Therefore, it is reasonable to assume that a user clicking the "x" with an empty search input is not trying to clear text, but rather is attempting to close the search input, because clicking an "x" to close a window is an extremely common design pattern.
This change has no effect on the behavior of the bar
variant.
This functionality was requested in #254.