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

webasssembly: improve keyboard handling

    XMLWordPrintable

    Details

      Description

      The key translation table currently uses the deprecated "keyCode" attribute, which is not completely reliable and makes detection of certain keys on certain browsers difficult. We should port to use "key" and code "code" instead.

      (we should also handle input and composition events, but first things first)

      Key event viewer: https://w3c.github.io/uievents/tools/key-event-viewer.html

      Sample key event attributes:

      Pressing the “a” key on a Norwegian Mac keyboard
      Chrome	keydown, key: "a", code: "KeyA", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 65, which: 65
      Firefox	keydown, key: "a", code: "KeyA", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 65, which: 65
      Safari	keydown, key: "a", code: "KeyA", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 65, which: 65
      
      Pressing the “^¨” key on a Norwegian Mac keyboard
      Chrome	keydown, key: "Dead", code: "BracketRight", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 221, which: 221
      Firefox	keydown, key: "Dead", code: "BracketRight", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 160, which: 160
      Safari	keydown, key: "Dead", code: "BracketRight", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 221, which: 221
      
      Pressing the “ø” key on a Norwegian Mac keyboard
      Chrome	keydown, key: "ø", code: "Semicolon", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 186, which: 186
      Firefox	keydown, key: "ø", code: "Semicolon", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 0, which: 0
      Safari	keydown, key: "ø", code: "Semicolon", location: 0, repeat: 0, locale: "", char: "", charCode: 0, keyCode: 186, which: 186
      
      Pressing the “command” key on a Norwegian Mac keyboard
      Chrome	keydown, key: "Meta", code: "MetaLeft", location: 1, META repeat: 0, locale: "", char: "", charCode: 0, keyCode: 91, which: 91
      Firefox	keydown, key: "Meta", code: "OSLeft", location: 1, META repeat: 0, locale: "", char: "", charCode: 0, keyCode: 224, which: 224
      Safari	keydown, key: "Meta", code: "MetaLeft", location: 1, META repeat: 0, locale: "", char: "", charCode: 0, keyCode: 91, which: 91
      

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            lpotter Lorn Potter
            Reporter:
            sorvig Morten Sørvig
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes