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

Starting devtools with activate: false makes it so that clicking on the main window does not bring it to the front #19285

Open
3 tasks done
pushkin- opened this issue Jul 16, 2019 · 19 comments

Comments

@pushkin-
Copy link

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: 5.0.6
  • Operating System: Windows 10

Expected Behavior

When I open devtools with activate: false, and the devtools appears in front of the main window, I expect that clicking on the main window will focus it and bring it to the front.

Actual Behavior

When doing the above, the main window does not get sent to the front, but it does get focus.

To Reproduce

main.js:

const { app, BrowserWindow } = require('electron')

function createWindow() {
  const mainWindow = new BrowserWindow();
  mainWindow.webContents.openDevTools({ mode: "detach", activate: false });
}

app.on('ready', createWindow)

Run npm start. Make sure that devtools is at least partially covering the main window. Notice that clicking on the main window that's in the back does not bring it to the front.

Observations:

  1. The main window does get focus, and you can successfully open menu items
  2. Clicking on the devtools and then back to the main window will bring the main window to the front
  3. You can resize the main window and still observe the issue (resizing doesn't work around it)
@pushkin-
Copy link
Author

This is also an issue in Electron 7.1.2

@darkguy2008
Copy link

Doesn't seem to happen in 8.2.3 but activate=false does nothing, the devtools window is always brought to the foreground :/

@pushkin-
Copy link
Author

@darkguy2008 I can repro with 8.2.2. activate=false will keep the devtools window unfocused, but the problem is that focus doesn't go into my actual page.

activate=true will truly focus the devtools window, so it does have some effect.

@darkguy2008
Copy link

darkguy2008 commented Apr 26, 2020

@pushkin- not in my case though, how are you calling the main window? in my case I do this:

app.allowRendererProcessReuse = true;
app.on('ready', () => {
    var dev = new BrowserWindow({
        width: 800,
        height: 600,
        minWidth: 800,
        minHeight: 600,
        y: 300,
        x: -800,
    });

    var win = new BrowserWindow({
        width: 800,
        height: 600,
        minWidth: 800,
        minHeight: 600,
        y: -800,
        x: 400,
        title: 'Editor'
    });


    win.webContents.setDevToolsWebContents(dev.webContents);
    win.webContents.openDevTools({ mode: 'detach', activate: true });
    win.loadFile(path.join(__dirname, "../angular/dist/index.html"));
    win.maximize();
    dev.maximize();
});

Setting activate: true or false in my case has no effect :( so I had to move the windows to separate monitors on launch so I could see the devtools window first.

@pushkin-
Copy link
Author

@darkguy2008 I'm not using setDevToolsWebContents. See the example in my initial post for how I'm calling it.

@pushkin-
Copy link
Author

Still a problem in Electron 10.1.2

@andmm
Copy link

andmm commented Aug 1, 2022

This issue still happens on version 19.0.10. Activate flag does nothing and the devtools panel or window always get the focus.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 31, 2022
@pushkin-
Copy link
Author

pushkin- commented Oct 31, 2022

still repros with Electron 21. Gist

@github-actions github-actions bot removed the stale label Nov 1, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jan 31, 2023
@pushkin-
Copy link
Author

repros in v22, gist

@github-actions github-actions bot removed the stale label Feb 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label May 3, 2023
@pushkin-
Copy link
Author

pushkin- commented May 3, 2023

bump

@github-actions github-actions bot removed the stale label May 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Aug 3, 2023
@pushkin-
Copy link
Author

pushkin- commented Aug 3, 2023

bump

@github-actions github-actions bot removed the stale label Aug 4, 2023
@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@pushkin-
Copy link
Author

pushkin- commented Nov 3, 2023

repros in v27

@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@pushkin-
Copy link
Author

pushkin- commented Feb 3, 2024

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
5.0.x
Unsorted Issues
Development

No branches or pull requests

5 participants