Can't unMaximize from Fullscreen macOS using Electron


I’ve created custom MacOS buttons for my app using React and Electron. The kind of work, however, when you put the app into fullscreen using the ‘green traffic light’ you then can’t take it back to normal.

Source Code:

Any ideas why that is?