User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: Html5 app loses keyboard focus

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Html5 app loses keyboard focus

    Hi,
    I've found this random bug that happens rarely (I've only seen it on Chromebooks and only rarely) where my application loses keyboard focus. The game is in an iframe. It is not possible to get the keyboard to focus on the app again unless you have an edit box that you type into. Otherwise the keyboard just scrolls the window around. I'm not sure why this occurs. Any ideas would be great. Thanks,
    Brett

  2. #2
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Html5 app loses keyboard focus

    Quote Originally Posted by brett View Post
    Hi,
    I've found this random bug that happens rarely (I've only seen it on Chromebooks and only rarely) where my application loses keyboard focus. The game is in an iframe. It is not possible to get the keyboard to focus on the app again unless you have an edit box that you type into. Otherwise the keyboard just scrolls the window around. I'm not sure why this occurs. Any ideas would be great. Thanks,
    Brett
    Did you find the cause or a solution to this? What is happening in the application when focus is lost? Are you able to focus on the edit box then unfocus immediately?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Still no solution. Basically what happens is that the keyboard keys (specifically the game uses the arrow keys and spacebar) stop working in the game and instead start to move the webpage around. It is not possible to click on the app to get the keyboard to work again. I'm not sure if it has something to do with the game being in an iframe. It only happens rarely and I've only seen it on Chromebooks, but it could occur elsewhere but I haven't seen it.

  4. #4
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Html5 app loses keyboard focus

    Quote Originally Posted by brett View Post
    Hi,
    Still no solution. Basically what happens is that the keyboard keys (specifically the game uses the arrow keys and spacebar) stop working in the game and instead start to move the webpage around. It is not possible to click on the app to get the keyboard to work again. I'm not sure if it has something to do with the game being in an iframe. It only happens rarely and I've only seen it on Chromebooks, but it could occur elsewhere but I haven't seen it.
    If you want to PM me the link or any files I can help test it to see if I can't bring about the issue and maybe solve it

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi Ratty,
    I am not sure how to solve this but have more info on it now. It seems that the problem occurs if you click outside of the iframe. This causes the iframe to lose focus. For some reason, when you click back on the iframe, it doesn't re-focus on it. I am trying to figure out a way to make this work with javascript right now, but I'd welcome any tips. I haven't had much luck yet. Thanks,
    Brett

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    By the way, here is an example of where it occurs:
    http://biomanbio.com/HTML5GamesandLa...pagehtml5.html
    Thanks!

  7. #7
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I haven't dug into your issue on a Chromebook yet but I think we might be seeing a similar issue. On iOS (Chrome/Safari) I can't use keyboard controls with your game either. I've been working on my HTML5 exporter skills and have found that unless a visible, on-screen edit box is always taking focus, the keyboard focus is lost instantly. I'm desperate for a fix to this, seeing as it doesn't seem to happen on PC.

    If anyone knows how to retain keyboard focus, or how to hide an edit so it's at least not seen to have the focus, I'd love to know...

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi Ratty,
    Yves sent me a solution posted by another user in the bugbox that worked for me. Here it is (from a user named Burfelt):

    "The Iframe must have an ID that you can set focus to. In the following example it is expected that the iframe has the id 'iframe_canvas'.

    This is the javascript then needed in the parent html doc that also contains the iframe tag. Basicly it reverts focus back to the iframe every 1 second. Unfortunately the function has to run every 1 sec, as you cannot test for iframe focus lost, as not all browers seem to support that.

    <script>
    function setFocusIframe() {
    var iframe = document.getElementById("iframe_canvas");
    iframe.contentWindow.focus();
    }
    setInterval(setFocusIframe, 1000);
    </script>

    "

    I'm not sure if there is a better way but this did appear to work. I hope this works for you too. Thanks!
    Brett

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Jan 2010
    Posts
    536
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Also, it turns out it was happening on other computers (not just Chromebooks) but I didn't notice since I wasn't clicking outside of the frame...

  10. #10
    No Products Registered

    Join Date
    Oct 2016
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, so I'm having a very similar problem with my game when I host it on NewGrounds, being that the arrow keys and space bar move the entire browser window. Only I don't even have to click outside the frame for this to occur, it just always occurs.

    The script that Brett posted might be useful, but I have no idea how to implement a script into clickteam fusion? (I don't even know what an iframe is)

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Object created on restart & issues when game loses focus
    By Janette5 in forum Android Export Module 2.5
    Replies: 5
    Last Post: 15th September 2016, 09:55 AM
  2. Bug: Can't stop movement ever again once flash loses focus
    By Burfelt in forum SWF/Flash Export Module Version 2.0
    Replies: 9
    Last Post: 11th March 2013, 09:27 AM
  3. BUG: Mouse inputs stop working if the app window loses focus in the debugger
    By mobichan in forum iOS Export Module Version 2.0
    Replies: 0
    Last Post: 3rd February 2012, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •