If you turn the node title field into an autocomplete field by hooking the form and adding an autocomplete path to the field, the autocomplete results are positioned incorrectly. When viewing the form in Bartik, through Firefox, the results show up in the upper left corner of the browser window.
To reproduce:
Hook into the node add form for a node type.
Define a valid autocomplete path for the title field (user/autocomplete works well for testing).
Load the form in Bartik and test the autocomplete title field.
My understanding of the problem:
The absolutely-positioned autocomplete matches list appears to make the assumption that some not-to-distant parent element is positioned relative. In the case of the title field on a node form in Bartik, that assumption is incorrect and it throws the placement off.
Proposed fix:
Update code in autocomplete.js to position the parent of the autocomplete input element relative.
Patch to follow...
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal-autocomplete-placement-bug-2157907-0.patch | 1.58 KB | chrisolof |
Comments
Comment #1
chrisolofThe attached patch fixes the bug by positioning the autocomplete popup's parent element relative while the popup is open.
This is achieved by defining "position: relative;" for the class "autocomplete-parent" in system.base.css and adding that class to the autocomplete popup's parent element (via autocomplete.js) when the popup is open. When the popup is removed, so is the class on the parent element.
Ready for review.
Comment #2
chrisolofComment #3
quotesbro commentedThis is a duplicate of #1218684: Autocomplete popup positioned 2.5em lower in "Seven theme" using Firefox