Places Autocomplete Popup Incorrectly Positioned when window.scrollY > 0

59 views
Skip to first unread message

Ross Allen

unread,
Jun 28, 2011, 5:29:19 PM6/28/11
to google-map...@googlegroups.com
This started happening sometime yesterday while I was trying the Places Autocomplete JS. You can reproduce the problem on the example:

  1. Insert a div as the first element in the body
  2. Give it a big height ("1000px" works)
  3. Scroll the window to the Autocomplete input
  4. Type something to bring up Autocomplete and check out where it is rendered
    • Autocomplete popup isn't positioned below the input (it looks like it is at the input - the current window.scrollY)
JS to do steps 1 - 3 and focus the input:

var d = document.body.insertBefore(document.createElement("div"), document.getElementsByTagName("div")[0]);
d.style.height = "1000px";
window.scroll(0, 1000);
document.getElementsByTagName("input")[0].focus();
Reply all
Reply to author
Forward
0 new messages