<?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>25338</bug_id>
          
          <creation_ts>2014-04-14 09:19:42 +0000</creation_ts>
          <short_desc>D3E spec should recommend that KeyboardEvent.code of some keys whose label are different from PC&apos;s keyboard should be mapped from the key labels on Mac keyboard</short_desc>
          <delta_ts>2014-05-13 00:28:14 +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 - DOM3 Events</component>
          <version>unspecified</version>
          <rep_platform>Macintosh</rep_platform>
          <op_sys>MacOS X</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>garykac</cc>
    
    <cc>mike</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>103805</commentid>
    <comment_count>0</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-04-14 09:19:42 +0000</bug_when>
    <thetext>On Mac, when PC keyboard is corrected, following keys have different label.

Mac                         PC
F13                         PrintScreen
F14                         ScrollLock
F15                         Pause
Help                        Insert *1
Clear                       NumLock

*1 not present on modern Mac keyboard, but there was the key on legacy Mac keyboard, and Sun keyboard&apos;s Help key maps kVK_Help

I think that we can ignore &quot;backspace&quot; vs. &quot;delete&quot; because Mac&apos;s keyboard also has &quot;delete&quot; key on function block with forward delete key&apos;s symbol. I.e., the delete key above return key works really as &quot;Backspace&quot; key.

So, the problem is, if D3E spec undefined whether browsers should map code value from PC&apos;s key name or Mac&apos;s key name, there will be compatibility problem between browsers.

I believe that browsers on Mac should prefer Mac&apos;s keyboard label. The reason is, these keys mentioned above are not work as PC. So, for browser users, they are different keys from PC. Additionally, ordinal Mac users must use Mac&apos;s keyboard rather than PC&apos;s keyboard.

Therefore, I believe that D3E spec should note this, and browsers should map the keys as:

Mac                         Preferred .code value
F13                         F13
F14                         F14
F15                         F15
Help                        Help
Clear                       Clear</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103806</commentid>
    <comment_count>1</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-04-14 09:22:13 +0000</bug_when>
    <thetext>FYI: Of course, KeyboardEvent.key value should be mapped from actual key&apos;s purpose since .key should represent its purpose.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103907</commentid>
    <comment_count>2</comment_count>
    <who name="Gary Kacmarcik">garykac</who>
    <bug_when>2014-04-15 21:15:50 +0000</bug_when>
    <thetext>This is already working as intended.

There are different USB codes for
   F13-F24 = 68/69/6a
and
   PrintScreen/ScrollLock/Pause = 46/47/48

So they are different keys.

Apparently, the OS (or KVM switch) will map these keys to F13-15 on a Mac, but as far as the spec is concerned, we don&apos;t care.  If these keys are reported to the browser as PrintScreen/et al., then they should be encoded as PrintScreen,...  If they come through as F13... then that&apos;s how they should be encoded.

In this case, Mac users will see F13,... because the OS (or some other lower component) is translating the PrintScreen into F13.

So this is way beyond the scope of what we need to worry about for this spec.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103932</commentid>
    <comment_count>3</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-04-16 01:24:22 +0000</bug_when>
    <thetext>Indeed...

On Mac, browsers cannot refer scan code because NSEvent of Cocoa and EventRef of Carbon don&apos;t provide it. Instead of that, virtual keycode provided by [NSEvent keyCode] is the only hint.

So, we cannot distinguish F13-F15 and Help. So, using these values to .code must be the best solution.

How about &quot;Clear&quot; case? It uses NumLock ID, IIRC. Should browsers use &quot;NumLock&quot; for &quot;Clear&quot; on Mac?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104312</commentid>
    <comment_count>4</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-04-24 03:59:58 +0000</bug_when>
    <thetext>Garykac:

Could you check the my last question? I confirmed that Mac&apos;s clear key is NumLock key. Only the physical label is different.

So, on Mac, which is better &quot;NumpadClear&quot; vs. &quot;NumLock&quot; on Mac browsers?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104314</commentid>
    <comment_count>5</comment_count>
    <who name="Masayuki Nakano">masayuki</who>
    <bug_when>2014-04-24 04:18:45 +0000</bug_when>
    <thetext>According to the purpose of KeyboardEvent.code, even on Mac, the clear key should be &quot;NumLock&quot;. However, I&apos;m not sure if web applications want such behavior.

KeyboardEvent.key of the key on Mac is &quot;Clear&quot;. So, even if KeyboardEvent.code is &quot;NumLock&quot; on Mac, it might be OK for web apps.

With those reasons, it might be better to use &quot;NumLock&quot; code value for the key even on Mac. But then, I strongly hope that the table in &quot;6.3.1.4 Numpad Section&quot; should add comment &quot;Clear key on Mac keyboard&quot; into &quot;Notes (Informative)&quot; cell for &quot;NumLock&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104521</commentid>
    <comment_count>6</comment_count>
    <who name="Gary Kacmarcik">garykac</who>
    <bug_when>2014-04-28 04:06:27 +0000</bug_when>
    <thetext>If &quot;Clear&quot; on the Mac produces the same code as &quot;NumLock&quot;, then it would be nice if they were the same.

My only concern is that NumLock implies a state (locked or unlocked) which Clear doesn&apos;t have.

Because of this, I think that it&apos;s better to have the Mac &quot;Clear&quot; key produce a separate code like &quot;NumpadClear&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104768</commentid>
    <comment_count>7</comment_count>
    <who name="Gary Kacmarcik">garykac</who>
    <bug_when>2014-04-30 00:22:52 +0000</bug_when>
    <thetext>I&apos;m OK with Mac Clear being the same as NumLock (esp since that&apos;s the USB code that it returns).

We still need to keep NumpadClear around for keypad like the following (that Travis found):
http://www.bing.com/images/search?q=microsoft+sculpt+number+pad&amp;FORM=HDRSC2&amp;id=F9469927A0E2504497E3C941499BD5C903520074&amp;selectedIndex=22#view=detail&amp;id=F9469927A0E2504497E3C941499BD5C903520074&amp;selectedIndex=0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105796</commentid>
    <comment_count>8</comment_count>
    <who name="Gary Kacmarcik">garykac</who>
    <bug_when>2014-05-13 00:28:14 +0000</bug_when>
    <thetext>The Clear/NumLock issue is fixed in https://dvcs.w3.org/hg/dom3events/rev/6c2226898bf9</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>