Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't set menu prop "visible" on separator! #42264

Closed
MoConWu opened this issue May 24, 2024 · 2 comments
Closed

[Bug]: Can't set menu prop "visible" on separator! #42264

MoConWu opened this issue May 24, 2024 · 2 comments

Comments

@MoConWu
Copy link

MoConWu commented May 24, 2024

          It was aslo has wrong!

OS: Windows11
image

You can see the image:
2024524-上午-111644

// main.js
const { app, BrowserWindow, Menu  } = require('electron')
const path = require('node:path')

function createWindow () {
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js')
    }
  })

  mainWindow.loadFile('index.html')

  const menuTemplate = [
    {
      label: 'test',
      submenu: [
        {
          label: '000'
        },
        {
          type: 'separator',
          visible: false
        },
        {
          label: '111'
        },
        {
          type: 'separator',
          visible: false
        },
        {
          label: '222'
        },
        {
          type: 'separator',
          visible: false
        },
        {
          label: '333',
          visible: false
        },
      ],
    }
  ];

  const menu = Menu.buildFromTemplate(menuTemplate);
  Menu.setApplicationMenu(menu);
}


app.whenReady().then(() => {
  createWindow()

  app.on('activate', function () {
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})


app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') app.quit()
})

Originally posted by @MoConWu in #41132 (comment)

@MoConWu
Copy link
Author

MoConWu commented May 24, 2024

Test use Electron Fiddle
Electron Version: v30.0.8

@MoConWu MoConWu changed the title Can't set menu prop "visible" on separator! [Bug] Can't set menu prop "visible" on separator! May 24, 2024
@MoConWu MoConWu changed the title [Bug] Can't set menu prop "visible" on separator! [Bug]: Can't set menu prop "visible" on separator! May 24, 2024
@codebytere
Copy link
Member

#41132 (comment)

@codebytere codebytere closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants