locked
No Respone On First Mouse Click or Screen Touch

    Question

  • I open my app and enter a page. Everything works normally when I click on an item and use the back button to return to the homepage and repeat.

    The problem starts when I click on an appbar button that has a link to another page in my app. The first click of the mouse on the new page does nothing. After the first click, it returns to normal, allowing me to hover on items and select them. Any ideas why this is happening? Is there a piece of code missing that needs to be executed upon entering a page (set focus perhaps)?

    My appbar js button code looks like this:

       

    function gotoHome() {

            history.go(1);

            nav.navigate(

    "/pages/landing/landing.html");

        };

    ready portion...

                document.getElementById(

    "goHome").onclick = gotoHome;

    html:

    <

    div id="topappbar" data-win-control="WinJS.UI.AppBar" class="customColor"


               

    data-win-options="{placement:'top'}">


               

    <button id="goHome"


                   

    data-win-control="WinJS.UI.AppBarCommand"


                   

    data-win-options="{id:'goHome', section:'selection', label:'Welcome Page', icon:'home', tooltip:'Return to Welcome page'}">


               

    </button>

    </div>

    Saturday, August 24, 2013 4:14 PM

Answers

  • Hi

    I tried your code in my project, everything works fine, it's really strange that you meet such behivour.

    So could you share your code with us via skydrive, or can you try to repro a similar project to see what's the problem is.

    Another idea is you could set a breakpoint somewhere in your GoHome() function to see if this function has been called or not.

    My code is below:

    //both are ok document.getElementById("goHome").addEventListener("click", gotoHome, false); document.getElementById("goHome").onclick = gotoHome;

    //your function function gotoHome() { history.go(1); WinJS.Navigation.navigate("/html/appbar-commands.html", null); //nav.navigate("/html/appbar-commands.html"); };

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by jflintstone81 Wednesday, August 28, 2013 12:01 PM
    Tuesday, August 27, 2013 3:24 AM
    Moderator

All replies

  • Hi jflintstone81,

    It seems your homepage is "landing.html", and could you try following code in your GoHome() function:

    WinJS.Navigation.navigate("/pages/landing/landing.html", null);

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 26, 2013 3:25 AM
    Moderator
  • Thanks for the reply. That did not seem to work, however. Still have the same issue.
    Monday, August 26, 2013 11:36 AM
  • Hi

    I tried your code in my project, everything works fine, it's really strange that you meet such behivour.

    So could you share your code with us via skydrive, or can you try to repro a similar project to see what's the problem is.

    Another idea is you could set a breakpoint somewhere in your GoHome() function to see if this function has been called or not.

    My code is below:

    //both are ok document.getElementById("goHome").addEventListener("click", gotoHome, false); document.getElementById("goHome").onclick = gotoHome;

    //your function function gotoHome() { history.go(1); WinJS.Navigation.navigate("/html/appbar-commands.html", null); //nav.navigate("/html/appbar-commands.html"); };

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by jflintstone81 Wednesday, August 28, 2013 12:01 PM
    Tuesday, August 27, 2013 3:24 AM
    Moderator
  • I tried it on a new template and it does work fine. There must be something buggy in my default or navigator javascript code. I'll try to figure it out. Thanks.
    Wednesday, August 28, 2013 12:01 PM
  • So I determined the problem is only present when using appbar buttons for navigation to other pages. Still not entirely sure how to correct this issue but wondering if anyone has any hints.
    Saturday, August 31, 2013 1:16 AM