Super weird keyDown issue turning ⌘⌥P into ⌘,

Originator:CharlesJS
Number:rdar://39304547 Date Originated:4/9/2018
Status:Open Resolved:
Product:AppKit Product Version:macOS 17E199
Classification:UI/Usability Reproducible:Sometimes
 
Summary:

Okay, I've found a weird one for you: If you have your Keyboard Layout set to "ABC - Extended" and you type the keyboard combo ⌘⌥P, the "characters" property of the resulting NSEvent is the comma, ",". This is apparently due to the fact that ⌥P in the "ABC - Extended" layout is used to type a combining comma, which followed by an "s" or "t" can produce the characters "ș" and "ț", and if neither of these two characters is pressed afterward, it ends up falling back to a normal comma. However, invoking the combining behavior doesn't really make sense when the Command key is down, and it's messing up menu shortcuts.

In particular, the popular Adobe HTTP/CSS/JavaScript editor, "Brackets", is affected by this; its "Live Preview" menu item has the shortcut ⌘⌥P whereas its "Preferences…" menu item, of course, is set to ⌘, and if you type ⌘⌥P while in the ABC Extended layout it appears to be undefined which menu item will be invoked. Sometimes, it will start a live preview, and sometimes, it will open the preferences. I presume this is probably also a problem in other applications which define ⌘⌥P as a keyboard shortcut.

Steps to Reproduce:

1. Set your keyboard layout to "ABC - Extended".

2. Compile and run the attached sample project.

3. Type ⌘⌥P, and notice that you get these results in the console:

NSEvent: type=KeyDown loc=(-9.78516,151.395) time=26366.7 flags=0x180128 win=0x6080001e0000 winNum=1824 ctxt=0x0 chars="," unmodchars="p" repeat=0 keyCode=35
Open preferences... ?!?!?!?!?!

As you can see the "Preferences…" item is invoked even though you did not type the shortcut for it.

Expected Results:

Typing the shortcut ⌘⌥P should invoke the menu item that has the shortcut ⌘⌥P, if there is one.

Actual Results:

Typing the shortcut ⌘⌥P *sometimes* invokes the menu item that has the shortcut ⌘⌥P, if there is one—but sometimes it gets interpreted as ⌘, and opens the preferences instead.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!