Issue
From some version (I don’t know which, maybe with UXP 3?) on, XD on macOS cancels the dialog when pressing the Enter key on macOS while the submit button is focused. As this was different before (and an integral part of my plugin’s UX), I assume this is a bug, which is why I post it here.
Steps to reproduce
- install Lorem Ipsum v1.3.0-rc.1
- Run the plugin on macOS using Cmd+Opt+L
- The plugin dialog gets shown and its Insert Text button hightlighted
- Press Enter
- The plugin cancels, like if you clicked Cancel
Expected Behavior
Pressing Enter should trigger the active button (or at least not trigger cancelling!)
Actual Behavior
The dialog gets canceled, as if a user pressed a Cancel button or the ESC key (the promise rejects with 'reasonCanceled'
). Furthermore, a warning sound indicating the key cannot get used in this context gets played.
Additional information
I was able to temporarily fix this by adding a 'keydown'
listener on the button where I manually resolve the Promise, cf. Release Candidate 2. The sound about an “invalid” shortcut still gets played, but the plugin, once again, works as intended.