Atom.confirm defaulted to first button on ESC key pressed?


#1

Hello everyone,
I just integrated an atom.confirm box in one of my packages, and I noticed the first button callback is always fired both when I press the ESC key and when i click on the small x in the upper right corner of the dialog window. I overcame this issue by inverting the buttons order, but I was wondering if there is a way to prevent this kind of issue.

Cheers!


#2

Thanks @leedohm for the edit, production work on Friday afternoon always makes me confused!


#3

The atom.confirm function is based off of Electron’s dialog.showMessageBox:

http://electron.atom.io/docs/api/dialog/

You may want to look there for solutions or call it directly. (Keep in mind that Atom doesn’t run on the latest version of Electron, so some capabilities that are in the latest Electron might not be available.)


#4

Using the electron APIs I’m actually able to assign a cancelId, so it gets easy to understand whether the user dismissed the box without clicking any button. For now I’ll probably stick with the inverted buttons though.

Thank you!