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

All child windows have active title bar #24647

Closed
3 tasks done
zarubond opened this issue Jul 20, 2020 · 1 comment · Fixed by #24847
Closed
3 tasks done

All child windows have active title bar #24647

zarubond opened this issue Jul 20, 2020 · 1 comment · Fixed by #24847
Assignees
Projects

Comments

@zarubond
Copy link
Contributor

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

  • Electron Version:
    6,7,8,9
  • Operating System:
    Window 10
  • Last Known Working Electron version:
    5.0.13

Expected Behavior

Only one window should have active title bar at one time.

Actual Behavior

All electron windows have active titlebar.

To Reproduce

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <script>
      // You can also require other files to run in this process
      function openWin() {
        let modal = window.open(\'\',\'modal\');
        modal.document.write('<h1>Hello</h1>');
      }
    </script>
    <button onclick="openWin()">Open window</button>
  </body>
</html>

main.js

// Modules to control application life and create native browser window
const {app, BrowserWindow} = require('electron')

function createWindow () {
  // Create the browser window.
  const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nativeWindowOpen: true
    }
  })

  mainWindow.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures) => {
  if (frameName === 'modal') {
    // open window as modal
    event.preventDefault()
    Object.assign(options, {
      width: 300,
      height: 300
    })
    event.newGuest = new BrowserWindow(options)
  }
})

  // and load the index.html of the app.
  mainWindow.loadFile('index.html')

  // Open the DevTools.
  // mainWindow.webContents.openDevTools()
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', function () {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow()
  }
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.

Screenshots

How it looks:
image

How it should look like:

image

Additional Information

@ckerr ckerr added this to Backlog / Unsorted in Issues Jul 20, 2020
@ckerr ckerr moved this from Backlog / Unsorted to Prioritized in Issues Jul 21, 2020
@ckerr ckerr moved this from Prioritized to Active in Issues Jul 28, 2020
@zcbenz zcbenz self-assigned this Aug 5, 2020
@zcbenz
Copy link
Member

zcbenz commented Aug 5, 2020

This is an upstream bug, I can reproduce with Chrome too.
Screen Shot 2020-08-05 at 15 55 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issues
Merged in Electron
Development

Successfully merging a pull request may close this issue.

3 participants