When Google Should Supply the Place Data, but Not the UI

By Rareș Gosman

Google’s default Places widget breaks out of your existing mobile UI, so a custom autocomplete keeps the form flow intact while Google still supplies the place data.

Google Places APIUXAutocomplete

I needed an address field with autocomplete, so I started with Google’s newer widget, google.maps.places.PlaceAutocompleteElement. The appeal was obvious: Google draws the suggestions and handles most of the interaction, and I wire the chosen place back into the form.

On a phone, the widget takes over the screen

The trouble showed up on mobile-sized screens. As soon as someone typed into the address field, the experience stopped feeling like “my form with a dropdown” and started feeling like “Google’s search UI inside my page.” The field effectively took over the visible screen, and the rest of the page felt hidden behind a Google-owned, overlay-like flow. I saw the same thing on a real iPhone and in Chrome’s mobile emulation on desktop.

Here it is:

Before

Google's default Places widget takes over the visible mobile flow instead of behaving like a local dropdown inside the form.

Since it happened in Chrome too, this wasn’t a Safari quirk. I took that to mean I was fighting the way the widget wants the field to behave.

I also hit a separate failure: a bad browser-key configuration made the widget’s own requests fail like this:

POST https://places.googleapis.com/$rpc/google.maps.places.v1.Places/AutocompletePlaces 403 (Forbidden)

That wasn’t why I replaced the widget, but if you see that error, check the key’s restrictions first.

Why a correct public example still didn’t fit

I found a public Shadcn-style example that used the modern Places API correctly. It queried suggestions with AutocompleteSuggestion.fetchAutocompleteSuggestions(...), used AutocompleteSessionToken, and resolved the final place with:

await place.fetchFields({ fields: ['formattedAddress', 'location'] })

That was the right technical direction, but still not the right component for my app. The example wasn’t bad; it was solving a slightly different product problem. Three differences mattered:

  • it loaded Google Maps its own way instead of reusing the app’s existing setup
  • it rendered suggestions outside the form instead of directly under the field, while my preferences page already had a good local dropdown pattern
  • it had its own rules for positioning and closing the menu instead of matching the behavior I already used elsewhere

Google for the data, my own input and dropdown

Once I stopped trying to style around the widget, the solution got simpler: keep Google for place suggestions and place details, but own the input and dropdown myself. In practice, that meant an app-controlled text input, an inline suggestions panel, and Google only for the data layer:

AutocompleteSuggestion.fetchAutocompleteSuggestions(...)
prediction.toPlace()
await place.fetchFields({ fields: ["formattedAddress", "location"] })

Here’s the same flow with my own input and dropdown, Google supplying only the place data.

After

The app keeps control of the input and suggestion panel while Google supplies only the place suggestions and place details.

That let me keep the nice parts:

  • place-name search, not just literal street addresses
  • exact coordinates when a user picks a result
  • fallback to manual entry when autocomplete is unavailable

And it let me remove the bad parts:

  • mobile takeover behavior
  • Google-owned layout decisions inside my form
  • UI states I couldn’t shape cleanly

Once I owned the control, I found that success didn’t need its own UI. The resolved address sitting in the field was enough, and the helper text below the input worked better once I reserved it for exceptions.

You still owe Google attribution

Owning the UI doesn’t get you out of Google’s rules. If you render custom autocomplete predictions without an embedded Google map, Google’s policies require attribution. In my case, I chose a small Google Maps footer inside the suggestion panel. That's one compliant layout, not the only possible one. If you replace Google’s UI, plan for attribution up front.

Two questions, two answers

Next time I’d split the decision in two from the start:

  1. Who should provide the place data?
  2. Who should own the input and dropdown?

Google is very good at the first one. If the field sits inside a dense form and you want it to behave like the rest of your app, own the second one yourself.