Github user mike-jumper commented on a diff in the pull request:

    
https://github.com/apache/incubator-guacamole-client/pull/209#discussion_r150925860
  
    --- Diff: guacamole-common-js/src/main/webapp/modules/Keyboard.js ---
    @@ -984,8 +1003,15 @@ Guacamole.Keyboard = function(element) {
                 // Release specific key if known
                 var keysym = first.keysym;
                 if (keysym) {
    +
    +                // Press CapsLock first if Keyup event is alone.
    +                // 
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Special_cases
    +                if (keysym === 0xFFE5)
    +                    guac_keyboard.press(keysym);
    --- End diff --
    
    Generally, yes, that seems the only safe option - always releasing after 
handling keydown for Caps Lock, and then leaving the keyup behavior unmodified. 
There's no need to inspect the keyboard object's event queue to determine 
whether a keyup event is already present, since if so that event will be 
handled immediately after the keydown handling is complete, and the keyup event 
will simply be ignored if the corresponding key has already been marked as 
released.
    
    Alternatively, if you want to browser sniff the quirk, I think that would 
be fine as well given the docs you've cited, but we should look to avoid 
repeating the sniff and to make the representation of the quirk(s) more 
semantic. From the iterations so far, it looks like this may even be as simple 
as just adding a call to `release()` if Caps Lock is known to be unreliable 
based on the platform test.


---

Reply via email to