<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>25968</bug_id>
          
          <creation_ts>2014-06-04 00:43:55 +0000</creation_ts>
          <short_desc>Needs clearer definition of virtual keyboard&apos;s KeyboardEvent.code value if it doesn&apos;t emulate physical key event completely</short_desc>
          <delta_ts>2015-10-07 04:14:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - UI Events</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Masayuki Nakano">masayuki</reporter>
          <assigned_to name="Gary Kacmarcik">garykac</assigned_to>
          <cc>bugs</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>107226</commentid>
    <comment_count>0</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-06-04 00:43:55 +0000</bug_when>
    <thetext>[09:33] &lt;masayuki&gt; If a VKB doesn&apos;t emulate native physical key event completely, there are 2 patterns:
[09:34] &lt;masayuki&gt; One is there is an API to compute scancode from virtual keycode. This is Windows&apos; case. At this time, browsers can use the API and compute .code value from the result.
[09:35] &lt;Travis&gt; I filed a bug for us to start investigating tests: https://www.w3.org/Bugs/Public/show_bug.cgi?id=25967
[09:36] &lt;masayuki&gt; The other is, the is not such API. E.g., Android. At this time, browsers can guess non-printable keys and some printable keys which can guess the key position from virtual keycode name. E.g., it has NUMPAD or something.
[09:36] &lt;garykac&gt; I don&apos;t expect all VKBs to provide useful &apos;code&apos; values for every key.
[09:36] &lt;garykac&gt; They should if they want to emulate a physical keyboard, but not all VKBs care about that.
[09:37] &lt;masayuki&gt; In the latter case, browsers should NOT set .code values for printable keys which must be in standard position because VK -&gt; SC depends on keyboard layout.
[09:39] &lt;masayuki&gt; https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#code-virtual-keyboards
[09:39] &lt;garykac&gt; VKBs that emulate a physical keyboard should be emulating a particular layout as well - so they should know what positions to use.
[09:39] &lt;masayuki&gt; This looks like that D3E spec recommends that browsers should guess the key position even in such case.
[09:40] &lt;garykac&gt; So I would expect a virtual french keyboard (with standard layout) to use &apos;KeyA&apos; for the key labeled &apos;q&apos;.
[09:41] &lt;garykac&gt; If they completely change the layout for the VKB, then the &apos;code&apos; doesn&apos;t have much use.
[09:41] &lt;masayuki&gt; I&apos;d like you to document about the latter case in the spec even if the VKB looks like emulating physical keyboard but not generating scancode properly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107227</commentid>
    <comment_count>1</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-06-04 00:54:11 +0000</bug_when>
    <thetext>My most important suggestion is, browsers SHOULD NOT try to guess code values of printable keys in standard position when a VKB doesn&apos;t emulate native physical keyboard event (i.e., no scancode) and the platform doesn&apos;t have API to compute scancode from virtual keycode.

If browsers did guess in such case, .code value would be untrusted attribute in such situation but web developers couldn&apos;t know whether they were in such case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107228</commentid>
    <comment_count>2</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-06-04 01:24:56 +0000</bug_when>
    <thetext>And Olli thinks that it&apos;s odd to guess non-printable .code value when browsers are not sure the printable keys&apos; code values.
https://bugzilla.mozilla.org/show_bug.cgi?id=1017383#c2

I think that it&apos;s okay browsers to set proper code value when a native virtual keycode includes position information e.g., SHIFT_LEFT, SHIFT_RIGHT, or is only generated with a scan value like SPACE.

However, indeed, if browsers shouldn&apos;t *guess* code value always, it makes the spec and behavior simpler.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118752</commentid>
    <comment_count>3</comment_count>
    <who name="Arthur Barstow">art.barstow</who>
    <bug_when>2015-03-21 15:11:57 +0000</bug_when>
    <thetext>Bulk move of all D3E bugs to the UI Events component.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123561</commentid>
    <comment_count>4</comment_count>
    <who name="Gary Kacmarcik">garykac</who>
    <bug_when>2015-10-07 04:14:40 +0000</bug_when>
    <thetext>Now tracking as: https://github.com/w3c/uievents/issues/26</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>