Cannot create a UIKeyCommand with command-period

Number:rdar://50474232 Date Originated:2019-05-04
Status:Open Resolved:
Product:iOS - UIKit Product Version:iOS 12.2 (16E227)
Classification:Usability Reproducible:Always

It appears that creating a UIKeyCommand whose input is a period (".") and whose modifierFlags value is UIKeyModifierFlags.command does not work.

I see that keyboard shortcuts whose input is UIKeyCommand.inputEscape gets called if the user presses command-period. I suspect that is related. Using UIKeyCommand.inputEscape could be an acceptable workaround, but if the user holds down the command key to see a list of keyboard shortcuts the shortcut listed is the escape key. That is not helpful to a customer with an Apple iPad keyboard that lacks an escape key.

Steps to Reproduce:

1. Open the attached sample project.
2. Observe that the view controller adds two key commands that are identical except that one has a keyboard shortcut of command-period and the other has a keyboard shortcut of command-L.
3. Run the attached sample project on an iPad with a hardware keyboard.
4. Hit command-L on the keyboard several times, and see the app log a message to the console indicating that it received the key command.
5. Hit command-period on the keyboard.

Expected Results:

I would expect hitting command-period to call handleKeyCommand, and for that to result in the following written to the console:

got key command -- input: Optional("."), modifierFlags: UIKeyModifierFlags(rawValue: 1048576)

Actual Results:

The handleKeyCommand function is not called. The first time command-period is pressed this is written to the console:

2019-05-04 17:28:35.961626-0400 CommandPeriod[401:33541] [MC] System group container for path is /private/var/containers/Shared/SystemGroup/
2019-05-04 17:28:35.963297-0400 CommandPeriod[401:33541] [MC] Reading from public effective user settings.


iOS 12.2 (16E227)


I see this on my iPad Air 2 with a Magic Keyboard attached.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!