pklaschka / xd-dialog-helper

An abstraction layer making it easier to display simple dialogs in plugins for Adobe XD CC
https://xd-dialog-helper.pabloklaschka.de
MIT License
6 stars 2 forks source link

Bug: Pressing 'Enter' cancels the dialog instead of okaying it #69

Open ttmc opened 4 years ago

ttmc commented 4 years ago

Description of the bug

When a generated dialog is open in Adobe XD and I press the Enter key on my keyboard, it has the same effect as clicking on the Cancel button (or pressing the Esc key). This is contrary to the Adobe XD user experience pattern given at:

https://adobexdplatform.com/plugin-docs/design/ux-patterns/modal-ux.html#key-commands

Meta-Data:

I'm using the xd-dialog-helper

Version: 1.0.5

pklaschka commented 4 years ago

Thank you for submitting this issue. I'll look into it asap (probably early next week).

May I ask on which platform you've noticed this behavior (macOS or Windows)? Thank you very much in advance 🙂.

ttmc commented 4 years ago

I noticed this behavior on my Windows 10 machine.

ttmc commented 3 years ago

I looked into fixing this bug, but I don't use TypeScript, so I got stuck.

However, I think I narrowed it down to the handling of form's submit event. Here's what the Adobe XD plugin reference docs say about that: https://adobexdplatform.com/plugin-docs/reference/ui/dialogs/dismissal.html

This Adobe XD sample code gives a more concrete example of how to do that. Look for form.onsubmit

And here's where the form's submit event gets handled in this project (i.e. in the source code):

https://github.com/pklaschka/xd-dialog-helper/blob/82f9a96dad878ea239462532c1252df11c7cf618/src/main.js#L99

I hope that is enough of a lead for you to figure out what to fix in this project's source code.