bootstrap-autocomplete icon indicating copy to clipboard operation
bootstrap-autocomplete copied to clipboard

list position not sticking under input when page length changes

Open bmatusiak opened this issue 5 years ago • 9 comments

a way to update position of the select menu.. i add stuff dynamically and this increases page size length, the dropdown menu seems not to stick under the input when this happens

bmatusiak avatar Jun 30 '19 23:06 bmatusiak

Hi @bmatusiak I can look into exposing a method to reposition the dropdown. Can you create a test environment on jsfiddle (or similar) to match your usecase?

xcash avatar Jul 01 '19 08:07 xcash

https://jsfiddle.net/yL0782d4/

bmatusiak avatar Jul 12 '19 14:07 bmatusiak

@xcash got that fiddle for ya

bmatusiak avatar Jul 12 '19 14:07 bmatusiak

i also noticed another bug, in this fiddle, add a line, and press "TAB" it re-selects last selected, this operations add 2x of the same thing

bmatusiak avatar Jul 12 '19 18:07 bmatusiak

https://gist.github.com/bmatusiak/f8dc536ad5566db4d3c71390857a7109/revisions

i copied some logic from v4 class and it seems to work for me,, #note in v4 that the code i copied is disabled

bmatusiak avatar Jul 13 '19 15:07 bmatusiak

and as for re-selecting on tab,, i turned off autoselect, but i like the autoselect feature in some cases,

so this other gist is another possible fix,

https://gist.github.com/bmatusiak/c857f66601599b947fa86e988a014ccb/revisions

bmatusiak avatar Jul 13 '19 15:07 bmatusiak

You should be able to resolve this by putting a wrapper div with position:relative; around the form of the autocomplete field. Then, add position:absolute; to .bootstrap-autocomplete.dropdown-menu

JHotown avatar Nov 25 '19 20:11 JHotown

Is this still a bug?

xcash avatar Aug 03 '20 15:08 xcash

workaround (BS4):

.on("autocomplete.dd.shown", function (evt) {
            const element = $(evt.target);
            const top = element.position().top + element.outerHeight();
            element.next().css("top", top);
})

pziewiec avatar Nov 30 '21 22:11 pziewiec