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

[Feature Request]: addChildView option to stop the added view grabbing focus #42339

Open
3 tasks done
GramboStorm opened this issue Jun 2, 2024 · 0 comments
Open
3 tasks done

Comments

@GramboStorm
Copy link

Preflight Checklist

Problem Description

Whenever addChildView is called to add a WebContentsView to an existing BaseWindow, the webcontents will always grab the focus from whichever has it currently. It would be very useful to have an option to add the child view without losing focus from the current web contents.

Example: I have a child view with an input box which, as you type, creates another child view showing related contents. After the child view is created and addChildView called, the focus switches to the new child view and you can't continue typing into the original input box.

Proposed Solution

Change addChildView from addChildView(view, [index]) to addChildView(view, [options]) where

options = { 
  index?:number,   // Default is the end of the list
  focus?:boolean   // Default is true
}

For backwards compatibility, check if options is a number and behave as it does currently.

Alternatives Considered

I've tried a number of alternatives, such as setting the parent BaseWindow with setFocusable(false) before adding the child view but this move other windows above the current and also loses focus.

Additional Information

No response

@GramboStorm GramboStorm changed the title [Feature Request]: addChildView option to stop it added view grabbing focus [Feature Request]: addChildView option to stop the added view grabbing focus Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant