You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First ajax search results displays normally (dropdown upwards). Search input field hangs on the second attempt.
Steps to reproduce the issue
When select element position close to lower end of the browser select2 results dropdown opens upwards (dropdown class is "select2-dropdown--above" situtation)
First results set loads into dropdown as usual after search with no position error. After the selection dropdown closes as usual. (auto close on select option is set)
If I click on select element again to make a new search, search input hangs way above the select element with a gap of empty space of the previous search results dropdown.
Expected behavior and actual behavior
When I analyse the select2.full.js#4.0.5 code, the line 806: Results.prototype.clear = function () { this.$results.empty(); };
clears the results set and dropdown content.
... and the line 4276:
var dropdown = { height: this.$dropdown.outerHeight(false) };
gets the dropdown height in px to calculate the position the results panel in AttachBody class.
The line of 1180:
container.on('results:message', function (params) { self.displayMessage(params); });
prints the text messages above the search input. But displayMessage function on line of 810 also fires the clear function on line 806.
The problem is; when the line 4277 calculates the height, previous results is already there.
If you log the runtime, after click (on select2 element) event (I skip the unrelated other events)
calculates the height of results panel,
fires the display message func.
fires the clear func.
appends the message container on its place
displays the search field and the message
So, with the ghost height of the previous dropdown results set, search input field hangs in the air.
Environment
macOs 10.13
Google Chrome 62.0.3202.89
Firefox Developer Edition 58.0b1
Safari 11.0 (13604.1.38.1.6)
The text was updated successfully, but these errors were encountered:
@onurkose@marcelpisowicz please consider submitting an actual PR instead of posting modified code in an issue. Furthermore, while your analysis is helpful, when you open a new issue when there is already an issue open (#4614), you're spreading out the conversation and making this bug more difficult to discuss and eventually fix.
#4614
http://jsbin.com/padukunigi/edit?html,js,output
Prerequisites
First ajax search results displays normally (dropdown upwards). Search input field hangs on the second attempt.
Steps to reproduce the issue
Expected behavior and actual behavior
When I analyse the select2.full.js#4.0.5 code, the line 806:
Results.prototype.clear = function () { this.$results.empty(); };
clears the results set and dropdown content.
... and the line 4276:
var dropdown = { height: this.$dropdown.outerHeight(false) };
gets the dropdown height in px to calculate the position the results panel in AttachBody class.
The line of 1180:
container.on('results:message', function (params) { self.displayMessage(params); });
prints the text messages above the search input. But
displayMessage
function on line of 810 also fires theclear
function on line 806.The problem is; when the line 4277 calculates the
height
, previous results is already there.If you log the runtime, after click (on select2 element) event (I skip the unrelated other events)
So, with the ghost height of the previous dropdown results set, search input field hangs in the air.
Environment
macOs 10.13
Google Chrome 62.0.3202.89
Firefox Developer Edition 58.0b1
Safari 11.0 (13604.1.38.1.6)
The text was updated successfully, but these errors were encountered: