Skip to content

Geocoder input does not get focus upon opening #182

Description

@mvl22

Currently, when the widget is added to the map, and the user hovers over the search button, the input field is uncollapsed, but the user has to give focus manually by clicking in the input field. This seems unnecessary, given that the user intention will almost always be to want to start typing.

It would therefore be useful to have a focus/autofocus option to add autofocus.

For now, the following workaround will do this:

// Add auto-focus to the widget
document.querySelector ('.maplibregl-ctrl-geocoder').addEventListener ('mouseenter', function () {
	document.querySelector ('.maplibregl-ctrl-geocoder--input').focus ();
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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