'Is it possible by clicking on Electron's MenuItem of type checkbox not to close the current submenu?

I have in my Electron app the submenu with a couple of MenuItems of type 'checkbox':

{
        label: 'Search settings',
        submenu: [
          {
            type: 'checkbox',
            checked: false,
            label: 'Aerodromes',
            click: (/* menuItem, currentWindow, event */) => {
              console.log('')
              console.log('menuItem Aerodromes is clicked')
              // TODO: change userPrefs about search sources
            }
          },
          {
            type: 'checkbox',
            checked: false,
            label: 'Heliports and HL',
            click: (/* event, focusedWindow, focusedWebContents */) => {
              console.log('')
              console.log('menuItem Heliports and HL is clicked')
              // TODO: change userPrefs about search sources
            }
          },
          {
            type: 'checkbox',
            checked: false,
            label: 'LP',
            click: (/* event, focusedWindow, focusedWebContents */) => {
              console.log('')
              console.log('menuItem LP is clicked')
              // TODO: change userPrefs about search sources
            }
          },
          ...
        ]
      },

When I click on every of these items, it's state 'checked/unchecked' updates correctly, but I can see the changes only after reopening this submenu again because immediately after clicking on any item the whole submenu gets closed (hidden). This is slightly not what I want. I would prefer to give the user the ability activate/inactivate (eg check/uncheck) all these checkbox-items inside the whole submenu until he decides he is done. How can I achieve this behaviour? Any good advice will be appreciated.

P.S.: I've played a lot with params of 'click' methods but without success ('event.preventDefault is not a function' etc)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source