Skip to main content

Search and Top Navigation

#10151 closed bug (notabug)

Opened July 10, 2014 11:25AM UTC

Closed July 16, 2014 08:56PM UTC

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.

Attachments (0)
Change History (6)

Changed July 10, 2014 11:28AM UTC by Kintar comment:1

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

Changed July 10, 2014 12:36PM UTC by tj.vantoll comment:2

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.

Changed July 10, 2014 12:44PM UTC by tj.vantoll comment:3

Actually... it looks like the autocomplete doesn't support changing the

position
option at all. The positioning gets screwed up if you try.

Changed July 10, 2014 12:48PM UTC by tj.vantoll comment:4

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.

Changed July 10, 2014 01:12PM UTC by Kintar comment:5

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

Changed July 16, 2014 08:56PM UTC by scottgonzalez comment:6

_comment0: 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, which subsequent settings always do a full set.1405544228825692
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.