onyx.item in an enyo.List works on desktop but not on android (phonegap) (enyo 2.2)

looks like this is due to the change in the FlyweightRepeater's claimNode function

changing:

 var n;
if (inNode) {
	if (inNode.id !== inControl.id) {
		n = inNode.querySelector("#" + inControl.id);
	}
	else {
		// inNode is already the right node, so just use it
		n = inNode;
	}
}
back to the old version:

var n = inNode && inNode.querySelectorAll("#" + inControl.id);
n = n && n[0];
seems to solve the problem.

Does this has some unwanted side effects (considering the new list code)?

Comments

  • edited February 2013
    Hmmm, I think you've found a bug. Try changing the code to
    var n = inNode && inNode.querySelector("#" + inControl.id);
    and see if it also works. That will point me to either a bug in the logic or just an Android bug on older versions.

    Does this reproduce in the sampler or is there another test I should try?

    I rewrote this as an optimization while verifying the recursive claiming process which is used more in the new list code, but I might have introduced a bug.
  • without the "n=n&&n[0]" part it's not working correctly.

    the following sample in chrome on android (SII) show that the wrong line is highlighted if you hold an item:
    http://jsfiddle.net/dCR63/embedded/result/
  • Try http://fiddle.jshell.net/dCR63/show/light/ on the SII, it's your fiddle outside of a frame. When I try that, I'm getting valid hits.

    This is telling me that the code might be masking off some sort of hit detection problem. I suspect that fwr.rowForEvent() isn't returning the right row, since this looks a lot like the screen density touch target issue that we had to work around.
  • it works correclty on chrome for android but not on the stock android browser (only the first row get the highlight like in phonegap.
  • edited February 2013
    Cool... I reproduce that. Thanks, I'm digging in. https://enyojs.atlassian.net/browse/ENYO-2019
  • just discovered this is still an issue with enyo 2.3.

    As I said replacing the commented code (see below) with the old version (pre 2.2) in the claimNode function of flyweightRepeater.js seems to fix it. Howewer I'm not sure I fully understand the logic here (maybe the n = n && n[0]; part is enough to fix the problem?)
    
    /*var n;
    if (inNode) {
        if (inNode.id !== inControl.id) {
    	n = inNode.querySelector("#" + inControl.id);
        } else {
            // inNode is already the right node, so just use it
    	n = inNode;
        }
    }*/
     
    //fix a bug in android stock browser and phonegap app where the selected onyx item is not highlighted correctly
    var n = inNode && inNode.querySelectorAll("#" + inControl.id);
    n = n && n[0];
    
  • Sorry -- this fell off our radar. I'll add your comments to the linked bug and stick it in my queue.
  • no problem. Thanks.
Sign In or Register to comment.