Skip to content

Instantly share code, notes, and snippets.

@shanesmith
Created May 9, 2012 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanesmith/2645017 to your computer and use it in GitHub Desktop.
Save shanesmith/2645017 to your computer and use it in GitHub Desktop.
Sencha Touch 1.1.1 Fix for Blackberry OS 7 Field Tap Bug
if (Ext.is.Blackberry) {
// Fix BlackBerry OS 7 issue where tapping on
// text fields does not give focus
Ext.gesture.Manager.onTouchEnd = function(e) {
if (this.isFrozen) {
return;
}
var gestures = this.currentGestures.slice(0),
ln = gestures.length,
i, gesture, endPoint,
needsAnotherMove = false,
touch = e.changedTouches ? e.changedTouches[0] : e;
if (this.startPoint) {
endPoint = Ext.util.Point.fromEvent(e);
if (!(this.lastMovePoint || this.startPoint)['equals'](endPoint)) {
needsAnotherMove = true;
}
}
for (i = 0; i < ln; i++) {
gesture = gestures[i];
if (!e.stopped && gesture.listenForEnd) {
// The point has changed, we should execute another onTouchMove before onTouchEnd
// to deal with the problem of missing events on Androids and alike
// This significantly improves scrolling experience on Androids!
if (needsAnotherMove) {
gesture.onTouchMove(e, touch);
}
gesture.onTouchEnd(e, touch);
}
this.stopGesture(gesture);
}
if (Ext.supports.Touch && this.isClick) {
this.isClick = false;
this.getEventSimulator().fire('click', this.startEvent.target, touch);
}
this.lastMovePoint = null;
this.followTouches = [];
this.startedChangedTouch = false;
this.currentTargets = [];
this.startEvent = null;
this.startPoint = null;
};
}
@shanesmith
Copy link
Author

Basically a copy of the original Ext.gesture.Manager.onTouchEnd with these few lines removed from the top

if (Ext.is.Blackberry) {
    e.preventDefault();
}

Not a nice fix at all, those lines must be there for a reason, but hey, it works.

Only tested on Blackberry Torch 9810 OS 7, untested anywhere else, be warned!

@CInnovat
Copy link

CInnovat commented Jun 5, 2012

Thanks a lot for posting a fix! Tested with 9860 OS7.0.0.261 works fine! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment