Another solution for clicks triggered on underlying elements
This commit is contained in:
parent
0d06066331
commit
c77e159178
17
select2.js
17
select2.js
@ -735,11 +735,24 @@ the specific language governing permissions and limitations under the Apache Lic
|
|||||||
this.container.on("click", killEvent);
|
this.container.on("click", killEvent);
|
||||||
|
|
||||||
installFilteredMouseMove(this.results);
|
installFilteredMouseMove(this.results);
|
||||||
this.dropdown.on("mousemove-filtered touchstart touchmove touchend", resultsSelector, this.bind(this.highlightUnderEvent));
|
|
||||||
this.dropdown.on("touchend", resultsSelector, this.bind(this.selectHighlighted));
|
this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
|
||||||
|
this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
|
||||||
|
this._touchEvent = true;
|
||||||
|
this.highlightUnderEvent(event);
|
||||||
|
}));
|
||||||
this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
|
this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
|
||||||
this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
|
this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
|
||||||
|
|
||||||
|
// Waiting for a click event on touch devices to select option and hide dropdown
|
||||||
|
// otherwise click will be triggered on an underlying element
|
||||||
|
this.dropdown.on('click', this.bind(function (event) {
|
||||||
|
if (this._touchEvent) {
|
||||||
|
this._touchEvent = false;
|
||||||
|
this.selectHighlighted();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
installDebouncedScroll(80, this.results);
|
installDebouncedScroll(80, this.results);
|
||||||
this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
|
this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user