Question about doing changing focus and navigation in one tick

Dear All,

I encountered a situation which caused much trouble to us...:

Assume there are 3 buttons: Top1, Top2 and Bottom1, Top2's navLeft is set to Top1, and Bottom1's navLeft is set to Bottom1 (it self).

When the focus is at Bottom1, and the user pressed left key, there is a keydown callback function in java script, which will catch the left key and set focus to Top2 by using setProperty() function. But the java script did not call stopPropagation() to stop this key down event to the markup.

So when the user actually pressed left key on Bottom1, the js engine will set the focused element to Top2, and then in the markup handler the left key event is processed, then the focused element is set to Top1. All these actions are done in one tick.

But we are sure that the intention of the content auther is to set focus to Top2 when the user pressed left key on Bottom. (Top1 and Top2 are top menu buttons, and Bottom1 is a sub menu button of Top2's menu, and pressing left on Bottom1 will go back to Top2)

 

Can someone analysis such situaion and tell why our implemention did not meet the auther's intention Any comment will be helpful. Thanks in advance~

 

Best Regards,
Rekan.



Answer this question

Question about doing changing focus and navigation in one tick

  • byronfromwesleyan

    Recently I had a similar problem. The thing is the processing order of the events. I noticed that this order is varying in different emulators and the Player. In the Toshiba player it seems to me that the event is first sent to the javascript and after this it is sent to the markup. In the sonic emulator it is exactly the other way. Perhaps your developer is using another simulator so that this issue appears.

    I believe I have seen an event precedence somewhere in spec but I can't remember where.


  • Harry Zhang

    The spec defines that events are sent to script first, then to markup. The Toshiba player is handling them correctly. Sonic is not, but is aware of the problem.
  • haploidus

    The call to unsetProperty is needed in order to let the navigation manager handle focus again. I seem to answer this one a lot, so maybe it needs a blog post :-)

    The spec is clear that events go to the script engine first; this is covered in the first paragraph of 8.3.1.

    If you are building a player, can you please e-mail me at ptorr@microsoft.com so I can put you in touch with the right folks here Thanks



  • aragon127

    Dear all,

    I shall describe the problem with more detail:

    The keydown callback function actually has these js codes:

    document.getElementById(Top2).state.focused = "true";    
    document.getElementById(Top2).state.unsetProperty("focused");

    There is a unsetProperty following the set focus code, so is this the reason why the left key event shall not apply to Top2

     

    And one more question, while the event shall be sent to java scrpit first then markup handler, is it possible that the event shall be sent to navigation handler (processing navLeft / navRight / navIndex ... ) first, then to java scrpit  

     

    Finally, thanks to all the helpful replies I got and you guys that read my posts. Thanks again~

    Best Regards,
    Rekan.


  • Question about doing changing focus and navigation in one tick