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

BrowserWindow removeMenu method not working on v7.1.1 #21088

Closed
3 tasks done
gschattenhofer opened this issue Nov 12, 2019 · 12 comments · Fixed by #21436
Closed
3 tasks done

BrowserWindow removeMenu method not working on v7.1.1 #21088

gschattenhofer opened this issue Nov 12, 2019 · 12 comments · Fixed by #21436

Comments

@gschattenhofer
Copy link

gschattenhofer commented Nov 12, 2019

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

BrowserWindow method removeMenu() is not working on v7.1.1. The only change made was upgrading Electron version.
https://electronjs.org/docs/api/browser-window#winremovemenu-linux-windows

  • Electron Version:
    • 7.1.1
  • Operating System:
    • Windows 10 (1903)
  • Last Known Working Electron version:
    • v6.0.3

Expected Behavior

Menu Bar not visible.

Actual Behavior

Menu Bar is visible.

To Reproduce

For me, just update Electron version.

Screenshots

With version 7.1.1:
image

With version 6.0.3:
image

@gschattenhofer
Copy link
Author

gschattenhofer commented Nov 12, 2019

I've also tried this by cloning electron/electron-quick-start which is using v7.1.1 and added mainWindow.removeMenu() on main.js inside createWindow function. It didn't removed the menu either.

v7.1.1
image

v6.0.3 (^6.0.3 resolves in 6.1.4)
image

@jacobq
Copy link
Contributor

jacobq commented Nov 13, 2019

Is this related to #15901?

@gschattenhofer
Copy link
Author

@jacobq Can't tell, i didnt used v4.0.0 betas.

btw Menu.setApplicationMenu(null); did the trick but still, if removeMenu isn't deprecated then it should be working by it self.

@jacobq
Copy link
Contributor

jacobq commented Nov 13, 2019

FWIW, I encountered the same behavior in Linux (5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-09-26) x86_64 GNU/Linux)

A quick test suggests that v7.1.1 behaves as follows:

Method Affects single window Affects all/child windows
{ autoHideMenuBar: true } Yes1 No
window.removeMenu() No 🐛 No
window.setMenu(null) No 🐛 No
window.setMenuBarVisibility(false) No 🐛2 No
Menu.setApplicationMenu(null) Yes Yes

1menu still accessible via keyboard shortcut (by design)
2does not work immediately but works when called after window has initialized, e.g.

mainWindow.webContents.once('did-finish-load', () => {
  mainWindow.setMenuBarVisibility(false);
})

@Pfuster12
Copy link

Pfuster12 commented Nov 14, 2019

If this was planned behaviour please deprecate the methods in the docs as well. It's a bit confusing!
EDIT Might be useful to add a note to the API docs for people that might be unaware of this issue.

@IceHacks
Copy link

Electron changes a lot in short amounts of time. It's like learning to use a whole new tool every update. Don't know whether that is good or bad. Not very backward compatible.

@PolyviosP
Copy link

this it work for me@ electron 7.1.1

const {app, BrowserWindow, Menu} = require(‘electron’)

Menu.setApplicationMenu(false)

@lunatupini
Copy link

this it work for me@ electron 7.1.1

const {app, BrowserWindow, Menu} = require(‘electron’)

Menu.setApplicationMenu(false)

This also worked for me @electron 7.1.2
But the win.removeMenu() shouldn't work as well?

@codebytere
Copy link
Member

@zcbenz re-assigning this since it's the original bug corresponding to the one assigned to you in the Releases WG meeting

@superheri
Copy link

Not only removeMenu is not working, setMenu is not working for me too on 7.1.2.

@yarhamjohn
Copy link

I have also found that neither win.removeMenu() nor win.setMenu(null) work in electron 7.1.3.

Whilst setting Menu.setApplicationMenu(false) does remove the menu bar, this isn't a good solution since it also disables the ability to bring up the debugging console when developing the application.

@lunatupini
Copy link

I have also found that neither win.removeMenu() nor win.setMenu(null) work in electron 7.1.3.

Whilst setting Menu.setApplicationMenu(false) does remove the menu bar, this isn't a good solution since it also disables the ability to bring up the debugging console when developing the application.

@yarhamjohn You can open the developer with win.webContents.openDevTools()

@sofianguy sofianguy moved this from Does Not Block Stable to Fixed for Next Release in 8.2.x Dec 9, 2019
@sofianguy sofianguy moved this from Unsorted Issues to Fixed for Next Release in 7.2.x Dec 9, 2019
@sofianguy sofianguy moved this from Fixed for Next Release to Fixed in 8.0.0-beta.5 in 8.2.x Jan 14, 2020
@sofianguy sofianguy moved this from Fixed for Next Release to Fixed in 7.1.5 in 7.2.x Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
7.2.x
Fixed in 7.1.5
8.2.x
Fixed in 8.0.0-beta.5
Development

Successfully merging a pull request may close this issue.