prixe / lindo

Lindo No-Emu allows you to play DOFUS touch on your computer (Windows/Mac/Linux). Fork of the original DTNE by Daniel & Thomas.
https://lindo-app.com
GNU General Public License v3.0
172 stars 97 forks source link

Prevent user from using invalid electron accelerators for tab switching #242

Closed riaddaima closed 2 years ago

riaddaima commented 2 years ago

An issue with registering some invalid characters shortcut using @hfelix/electron-localshortcut for tab switching has been fixed using regex validation only for tab switching.

Since we only use @hfelix/electron-localshortcut for tab switching, refer to this, we need to check if the shortcut input is for the application tab first, because we do not want to disable those working characters for spells, interface, etc.

I thought about using isValidElectronAccelerator(accelerator) but ShortcutInput.tsx is not in the electron context so this throws an error.

Regex source from: https://github.com/fxha/electron-localshortcut/blob/master/src/convert-accelerator.js#L10

riaddaima commented 2 years ago

image