| Issue 3416: | Autocomplete absolute positioning | |
| 33 people starred this issue and may be notified of changes. | Back to list |
The pac-container autocompletion div has position absolute.
This causes any resize of the browser window / movement of controls on the page to leave the autocomplete div in an old position. The control should be relative to the input field.
Moreover, it would be nice if the user had the choice to display the div inline (googlepage sutocomplete style) and not cover other elements on the page. That would be an option in the constructor shat would mean { show: overlay / inline }
*********************************************************
For developers viewing this issue: please click the 'star' icon to be
notified of future changes, and to let us know how many of you are
interested in seeing it resolved.
*********************************************************
Jun 21, 2011
#1
[email protected]
Labels:
-ApiType-PlacesAPI ApiType-Javascript3
Nov 20, 2011
this seems to be still an issue, will this be ever fixed?
Nov 20, 2011
The container cannot be relative because that requires altering developers HTML in ways that they may not expect. Instead the autocomplete now listens to the browser resize event as well as listening to a resize event that can developers cab triggered on it to make it reposition and resize. This should be released soon.
Status:
FixedNotReleased
Jun 6, 2013
(No comment was entered for this change.)
Status:
Fixed
Jul 20, 2015
I am still facing this issue in chrome with latest version even. Any help.
Jul 20, 2015
https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false&libraries=places I am using this version.
Sep 23, 2015
Not working on most mobile devices for me. Seems ok if zoomed all the way out, but if zoomed in at all, the pac-container div will be out of position.
Oct 2, 2015
Hi...currently the pac-container always appears below the input/search box...and for most applications this works fine. However, on my mobile app this causes the pac-container search options to be listed behind the device virtual keyboard (that automatically opens when the focus is on the input field). How can I get the pac-container to appear above the input/search box? Is there a simple Autocomplete(options) type parameter I can use or must I manually alter the style of the pac-container (and if so...what would the css be)?
Oct 2, 2015
...needless to say, when the pac-container opens behind the devices virtual keyboard then the user can't select any of the autocompleted search suggestions
Dec 20, 2015
I am also having this problem when viewing my desktop site on a tablet. when the user zooms in or out, the pac-container does not show under the input field anymore.
Jun 8, 2016
what happened with this problem? I am facing the same issue with cordova, when i scroll the page the suggestions stay in the same area of the page. :/
Sep 12, 2016
Facing the same issue, I've attached the Autocomplete to an input control and when the page scroll down/up .pac-container keeps showing it self on the same fixed place, it is not updating it's position according to input control position. Any one has triggered the resize event mentioned in comment #3?
Sep 13, 2016
Hi there, Perhaps you've found a new issue, different from the original one? It's hard to tell, since no one has attached any sample code / jsfiddle which would allow us to work out what's going wrong. Please consider giving us more detail. Thanks.
Sep 13, 2016
Here's sample code for a limitation I've run into on a project: https://jsfiddle.net/donmccurdy/shc8kw8j/ Because the modal has a fixed position, but the autocomplete menu does not, the scrolling causes skew. One possible solution, which would not require altering developers' HTML, might be to create a new option on google.maps.places.AutocompleteOptions like this: var wrapperEl = document.querySelector('#parent-el'); new google.maps.places.Autocomplete(input, {wrap: wrapperEl}); The autocomplete list could then be dropped into that wrapper, without any positioning applied.
Sep 13, 2016
Oh I see what you mean. That's bad. This seems to be because we ask you for an HTMLInputElement, which cannot have children. And for the drop-down menu to be positioned with the input field, it would have to be a child.
Sep 14, 2016
This is another issue related to the same problem https://code.google.com/p/gmaps-api-issues/issues/detail?id=8605
Sep 14, 2016
In my case (comment #12) .pac-container was being affected by a style sheet (from another plugin) that was setting: body { position:relative }. Setting the body position to inherit solved my issue.
Oct 5, 2016
Issue 8605 has been merged into this issue.
Oct 22, 2016
SOLVED Hello, Please check the link https://jsfiddle.net/shc8kw8j/3/ for your solution. Basically i also faced the same issue in my webpage, and found that the html,body{ height:100%} css value may not letting the google api to trigger the window.onscroll event. changing it to height:auto will solve this issue. I recommend Google api documentation should highlight this fix in bold and coloured text. Regards Amit Shah
Feb 14, 2017
It's a fix just for a particular use case. For a modal, body overflow is set to hidden and modal wrapper overflow is set to auto. The "update pac-container position" event is never triggered of course. Maybe an option to append the pac-container to a specific dom element might be nice...
Today (4 hours ago)
I am asthonished something this vital has still not been fixed. Many screenshots around the web of this issue with clear explanations yet months of misery and I too cannot release my project until this issue is resolved. It is a very simple problem that some users have already explained how to solve yet many months later it continues to plague developers. ISSUE: When on a desktop, large enough to fit the input used for autocomplete, the results are shown (correctly) directly under the input. However, on mobile (or desktop too if you resize the window small enough) - the results are appearing OFF SCREEN. Making it IMPOSSIBLE to implement without causing conversion chaos. As someone stated, this is because pac-container is relative to body and in a fixed position. They also clearly stated a solution which would be to allow developers an option to position the results relative to the input. This issue has been going on for months. I hope someone a little further up seriously considers pushing this up a little because out of all my adult life as a Googler... this is the ONLY question I have torn my hair out and still not been able to come to a solution for. Please!!! |
|
| ► Sign in to add a comment |