Tab and Arrow keys not working

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Tab and Arrow keys not working

Postby kurtaj » Thu Aug 27, 2015 8:02 am

I'm using 3.1750.1738 (win32) in a C++ application. When I host a web page, I've found that tab and arrow keys don't behave as expected. While other control keys (insert/delete/home/end) get a keydown and a keyup event, the tab and arrow keys are only getting keyup events. Sometimes, when I hold the tab key down for a few seconds, I'll get a few keydown events. This behavior makes it impossible for the user to navigate input fields with the keyboard.

Here's a minimal example, logging key events to the console...
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
        <script language="JavaScript" type="text/javascript">
            function keyhandle(action, e) {
                console.log( 'key' + action + ' event: ' + e.keyCode + ' ' + e.charCode );
            }

            onkeydown = function(e) { keyhandle( 'down', e ); };
            onkeyup = function(e) { keyhandle( 'up', e ); };
            onkeypress = function(e) { keyhandle( 'press', e ); };
        </script>

        <form>
            First name: <input type="text" name="fname"><br>
            Last name: <input type="text" name="lname"><br>
            <input type="submit" value="Submit">
        </form>
    </body>
</html>

When hosting the above in Chrome, I get the desired keydown/keyup events and can navigate between input fields with the keyboard. In CEF, I get only keyup events and must navigate with the mouse.

We plan on moving to the latest version of CEF soon, but doing so doesn't fit in our current release timetable.

Please let me know if you have any idea why it's behaving this way or suggestions on how to best address it.

Thanks,
Kurt Jacobson
kurtaj
Newbie
 
Posts: 5
Joined: Wed Aug 26, 2015 8:48 am

Re: Tab and Arrow keys not working

Postby magreenblatt » Thu Aug 27, 2015 9:23 am

It sounds like you already know how to address it -- update to a newer CEF version.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Tab and Arrow keys not working

Postby kurtaj » Fri Aug 28, 2015 4:35 pm

I've updated to 3.2171.1979 and get the same bad behavior.
Is this a known issue that's been resolved in more recent code?

Thanks,
Kurt
kurtaj
Newbie
 
Posts: 5
Joined: Wed Aug 26, 2015 8:48 am

Re: Tab and Arrow keys not working

Postby magreenblatt » Fri Aug 28, 2015 5:22 pm

Does the problem reproduce in cefclient with 2357 branch or newer?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Tab and Arrow keys not working

Postby kurtaj » Tue Jan 19, 2016 10:39 am

We finally got a window to move our application to VS2015; it was previously building on VS2010, which wasn't supported by the latest CEF.

This problem persists with CEF 3.2526.1366 (win32).

An additional observation: Sometimes the keydown event does happen; you just need to hold down the tab key for 3-5 seconds before the event gets processed. The keyup event always happens immediately when releasing the key.
kurtaj
Newbie
 
Posts: 5
Joined: Wed Aug 26, 2015 8:48 am

Re: Tab and Arrow keys not working

Postby magreenblatt » Tue Jan 19, 2016 2:29 pm

How are you running the CEF message loop?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Tab and Arrow keys not working

Postby kurtaj » Tue Jan 19, 2016 3:06 pm

We make a call to CefDoMessageLoopWork() in the main application message loop.

I tried moving the call to the top of the loop, thinking perhaps something was swallowing the pertinent messages, but that had no effect.
kurtaj
Newbie
 
Posts: 5
Joined: Wed Aug 26, 2015 8:48 am

Re: Tab and Arrow keys not working

Postby magreenblatt » Tue Jan 19, 2016 3:14 pm

Using CefDoMessageLoopWork is likely the issue. The easiest solution is likely to use multi_threaded_message_loop. https://bitbucket.org/chromiumembedded/cef/issues/1805 is also a potential solution (not yet merged).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Tab and Arrow keys not working

Postby kurtaj » Tue Jan 19, 2016 3:47 pm

Using multi_threaded_message_loop works!

Thanks!
kurtaj
Newbie
 
Posts: 5
Joined: Wed Aug 26, 2015 8:48 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 47 guests