Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69442

Event 'key' attribute is incorrect when multiple modifier keys pressed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.0 Beta 1
    • 5.11.1
    • WebEngine
    • None
    • Linux/X11, macOS

    Description

      One can reproduce within the Nano Browser example. Run the example, open the DevTools console using the dropdown menu on the right of the URL bar, and then try debugging a key event with something like:

      document.addEventListener("keydown", function(event) { if (event.keyCode == 65) { debugger; } });

      Then, focus the open page, and type Ctrl + Shift + A. The debugger will pause execution, and you can then inspect variables within scope.

      I notice a few oddities for the key down event:

      1. The key attribute is the empty string; I would expect it to be the uppercase A;
      2. The code attribute is wrong, and displays "KeyS". It seems to display this code regardless of what keys were pressed. I would expect KeyA in this case.

      I don't see either of these issues in Chrome 67.0.3396.99, Firefox 61.0.1.

      Note that these attributes are necessary for determining the actual key pressed by the user, as key codes are not unique across different keyboard layouts. For example, the comma key , has a key code of 188 when using a keyboard with an English layout, and the left-arrow key < also has a key code of 188 when using a keyboard with a German layout.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-69442
          # Subject Branch Project Status CR V

          Activity

            People

              juri.valdmann Jüri Valdmann (Inactive)
              kevinushey Kevin Ushey
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: