Bootstrap-3-Typeahead icon indicating copy to clipboard operation
Bootstrap-3-Typeahead copied to clipboard

Doesn't work with jQuery 3.4.1

Open doubleaxe opened this issue 5 years ago • 0 comments

After further investigation the bug appears in jQuery itself. It was introduced between 3.2.1 and 3.3.0 in January 2018 and still not fixed. This PR https://github.com/jquery/jquery/pull/3887 tries to fix it, but it wasn't merged. I already 'fixed' jQuery in my code, with $.fn.position = function() {. This bug report may be closed as invalid.

The bug is reproduced, if typeahead element is inside div with position: relative. Bootstrap <div class="col-sm-12"> for example.

They modified behavior of position() function in jQuery 3.3.0 here: https://github.com/jquery/jquery/issues/3107. Bootstrap-3-Typeahead relied on old position() behavior when calculating dropdown position, and now dropdown is displayed at top of window, instead of correct position. The bug is here:

        show: function() {
            var pos = $.extend({}, this.$element.position(), {
                height: this.$element[0].offsetHeight
            });

Temporary workaround is using static position, by appending dropdown to $('body'), but in this case dropdown is not scrolled with its parent element.

doubleaxe avatar Dec 16 '19 08:12 doubleaxe