Opened 5 years ago

Closed 5 years ago

#10151 closed bug (notabug)

Autocomplete: Position bug on reinitializing

Reported by: Kintar Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:

Description

http://jsfiddle.net/5gr8X/2/ - here is link to jsfiddle example - if we click "turn on" button, open autocomplete, then click "turn off", then click again "turn on" and open autocomplete - autocomplete position would be strange. While i do understand, that this code is not healthy (on place, where i found that, i had two autocompletes linked), and, actually, if we destroy autocomplete before reinitializing (disabling do not work), we will get what do we want to, it still looks strange for me.

Change History (6)

comment:1 Changed 5 years ago by Kintar

Oh, also, i forgot, that this is repeatable for me on all versions of jquery/jquery ui from 1.8.3/1.9.2 to 2.0.2/1.10.3

comment:2 Changed 5 years ago by tj.vantoll

Status: newopen
Summary: Position bug on reinitializing autocompleteAutocomplete: Position bug on reinitializing

Reduced: http://jsfiddle.net/tj_vantoll/4Gz3h/

If you call invoke the autocomplete() plugin twice on the same element, and you provide a position option, the positioning gets screwed up.

comment:3 Changed 5 years ago by tj.vantoll

Actually... it looks like the autocomplete doesn't support changing the position option at all. The positioning gets screwed up if you try.

comment:4 Changed 5 years ago by tj.vantoll

I should probably look in to these things more before commenting. Changing the position option works, BUT, the same merging of properties within the object that occurs upon initialization does not occur when changing the options. To me it seems like something we should support.

comment:5 Changed 5 years ago by Kintar

http://jsfiddle.net/LM7d9/1/ - changing position by chaining works, but by option - nope. Sorry for inconvenience

comment:6 Changed 5 years ago by Scott González

Resolution: notabug
Status: openclosed

This is actually working properly. In the first fiddle, you're using {my: 'left top+15'} which means that the default position (center) should be used for at. In the last fiddle, you're using {} which means both my and at should use the center.

The reason that the initial setting and the subsequent settings behave differently is because initialization always does a merge of the defaults and the provided options, while subsequent settings always do a full set.

Last edited 5 years ago by Scott González (previous) (diff)
Note: See TracTickets for help on using tickets.