Skip to content

Expose onClear event for Place Autocomplete Element #275

Description

@HMonica

Is your feature request related to a problem? Please describe.
I added the PlaceAutocompleteElement to a map, and when I select a location I also add a pin.
When I clear the input, I’d like to remove that pin as well. However, there’s currently no way to detect when the built-in clear (“X”) button is pressed.
Since the button lives inside a closed shadow root, developers can’t attach their own event listeners as a workaround.

Describe the solution you'd like
Expose a new event (e.g., clear, input-clear, etc.) that fires whenever the clear button is clicked.
Alternatively, allow developers to pass a handler or listen to an existing DOM event for this action.

Describe alternatives you've considered
None

Additional context
Just like there’s a gmp-select event when a place is chosen, it would be very convenient to also have a corresponding clear event for when the input is reset.

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

    triage meI really want to be triaged.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions