Skip to content

Geocoder input is left uncollapsed after selecting an item #183

@mvl22

Description

@mvl22

When auto-collapsing is used, when the user clicks on a result, the box is left open. It should be auto-closed, as the user has made a definitive decision and the action is complete.

I have created a workaround, but this is unsatisfactory because it force-clears the input:

// Auto-close on select; see: https://maplibre.org/maplibre-gl-geocoder/classes/default.html#on
geocoder.on ('result', function () {
	document.querySelector ('.maplibregl-ctrl-geocoder--button').click ();    // Click to remove the search value
	document.querySelector ('.maplibregl-ctrl-geocoder--input').blur ();      // Move away from the search box
});

I tried using the _collapse method, which seems to be advertised as public despite the underscore, but this had no effect, as I see its internal implementation ignores the call if there is focus.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions