0

Is there something special I need to do to map keyboard input to web app?

I am currently running an express server and a built react application on my HD1024. I have an event listener watching for key presses on a keyboard (this is temporary until we get the IR sensor). If the key that is pressed is "m" then a custom menu is supposed to open. In local development on my mac this all works fine running the same built index.html file in my browser. On the brightsign player, I have plugged in a keyboard and tried the same thing but it failed. I have edited the code to just console log any key presses and nothing is appearing in the console. Is there something special I need to do in the autorun file to map the key presses to work in the browser or to focus on the browser? On my computer, if I have not clicked in the browser window that is running the app, the key presses are not noticed or logged. I assume this is what's happening on the device. The page is displaying normally, but I feel like the window is not selected and so the key presses are doing nothing. I assume when I get the remote and try to press buttons on the remote the same issue will occur. Also, I am seeing this error in the log a lot, not sure if it's related:

[ 1131.394] requestActivate() called for QQuickView(0x15cccc0) which has Qt::WindowDoesNotAcceptFocus set.

** update ** I forgot to mention I also have a mouse connected and have confirmed that the error message above is appearing in the log after I try to click the mouse to focus on the browser window. The cursor is not visible but I assume it exists...

2 comments

  • 0
    Avatar
    Brandon Stryker

    So I've found a way to focus on the window, and once I do that the key presses act as I expect. When the app starts up, if I press tab one time the browser window showing the htmlWidget is focused and everything is cool. I have yet to find a way to programmatically simulate a press of the tab button or to automatically focus on the htmlWidget after it is created and show() is called. I know for sure the remote we will be using with these players does not have a "tab" key so still looking for a real fix here.

  • 0
    Avatar
    Bright Scripters

    Can you force focus through JS code once the page has loaded?

    That should eliminate the need for TAB key press.

    https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus

Please sign in to leave a comment.