Skip to content

Commit a0bdbe8

Browse files
hansohanso
authored andcommitted
1-ms timeout required for touch in j2ComboBox
1 parent 9f19b4c commit a0bdbe8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Binary file not shown.

sources/net.sf.j2s.java.core/src/swingjs/jquery/j2sComboBox.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*
88
*/
99

10+
// BH 2023.11.02 fixed touch issue not causing click -- hidePopup needed a 1-ms timeout
11+
1012
// NOTE: If you change this file, then you need to touch and save JQueryUI.java, as only then
1113
// will the transpiler copy this file to site/swingjs/j2s/swingjs/jquery/
1214

@@ -91,7 +93,7 @@ J2S.__makeComboBox = function() {
9193
display:'none'
9294
});
9395
this.list = $( '<ul>', {'class': 'j2scblist', 'id':id+'_list' });
94-
this.on2(this.list, 'click mousedown touchstart mousemove touchmove mouseup touchend mousewheel mouseover mouseout mouseenter mouseexit'.split(' '), '_mouse');
96+
this.on2(this.list, 'click pointerdown mousedown touchstart mousemove touchmove pointermove pointerup mouseup touchend mousewheel mouseover mouseout mouseenter mouseexit'.split(' '), '_mouse');
9597
this.popup.append(this.list);
9698
this.element.append(this.cont);
9799
// important to add popup after body so that it does not take on any body attributes
@@ -287,10 +289,14 @@ J2S.__makeComboBox = function() {
287289
this.element.focus();
288290
},
289291
hidePopup: function() {
290-
if (this.options.popupVisible) {
291-
this.options.popupVisible = false;
292-
this.popup.hide();
292+
// we need a time click here
293+
var me = this;
294+
setTimeout(function(){
295+
if (me.options.popupVisible) {
296+
me.options.popupVisible = false;
297+
me.popup.hide();
293298
}
299+
},1);
294300
},
295301
_overOpt: function(e) {
296302
this._stopT("_overOpt");

0 commit comments

Comments
 (0)