I've spend a few hours today on this issue and wondered if anyone else struggled with this too.
When you click a link or button in APEX 5.1 with a touch device, then click events are triggered twice.
Demo (open with touch device): https://apex.oracle.com/pls/apex/f?p=38211:7
I've tested with iphone 6 (safari + chrome) and two android devices (Samsung S7 & Asus tablet both using chrome).
In theme42.js there is a function which I think causes the issue:
var bindTapToClick = function() {
var windowsDoesNotSupportTouchProperly =
(navigator.platform && navigator.platform.toLowerCase().indexOf("win") !== -1);
if (!Modernizr.touch || windowsDoesNotSupportTouchProperly) {
return;
}
// Time out so that regions which need to render dynamically get hooked into this.
setTimeout(function() {
$("a, button").each(function() {
var el$ = $(this);
// Apply the "fast click" approach if any of the three conditions are met.
// - Hammer JS library exists.
// - The given element is NOT inside of a treeView widget.
// - The given element is NOT inside of a menuBar widget.
if (!Hammer || el$.parents(".a-TreeView").length > 0 || el$.parents(".a-MenuBar").length > 0) {
//TODO: Develop a better check for whether or not to use tap-to-click here.
return;
}
var hammertime = new Hammer(this);
var hammerMe = this;
hammertime.on('tap', function (ev) {
ev.preventDefault();
hammerMe.click();
});
});
}, 500);
};
I'm trying to find a way to unbind the tap event.
Does anyone know how to make sure the click event is triggered only once per tap/click?