Last instance steals focus when multiple instances are present
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What’s the current behavior?
In my use case, I have two instances present, one for making edits, and another for previewing the result.
When multiple instances are present, and you make edits to any instance but the last in the DOM, the last instance steals focus. It then becomes impossible to focus any instance but the last.
I know this issue was fixed before, but perhaps it resurfaced post-0.50.0
.
Codesandbox: https://codesandbox.io/s/spike-slate-u8zpz
Slate: 0.57.1 Browser: Chrome OS: Mac
What’s the expected behavior?
When multiple instances are present, the user should be able to interact and edit an instance without another instance stealing focus.
Are there any potential workarounds?
In my use case, I only require one instance to be editable, so ensuring that this instance is last in the DOM is working for me.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:16 (1 by maintainers)
Top Results From Across the Web
New instances stealing focus : r/BlueStacks
Hi! This is expected behavior. With every other program, once it has been opened, it now becomes the program in focus and therefore...
Read more >Windows 10 Randomly Loses Focus on Current ...
Scenario 2) I am actively typing in MS Word and my cursor disappears. ... It always takes focus when something is happening when...
Read more >Preventing applications from stealing focus - windows
Show activity on this post. Ghacks has a possible solution: It happens several times a day that some applications steal the focus of...
Read more >Visual Studio: How to stop breakpoint hit from stealing focus?
This is finally fixed in VS2019. Go to Tools->Options->Debugging->General, down at the bottom is "Bring Visual Studio to the foreground when breaking in...
Read more >Crusade against focus stealing
Hereby, I convoke all IDEA users out there to gather together, and let our frustration be heard. It's a battle against the thieves,......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As @CameronAckermanSEL said, to refer the same value occurs this bug. In my case, I need two or more editor components that don’t need shared texts, but they refer the same value as an initial value for
useState
like the following.In the above codes,
initialValue
is an object and the same objects have the same addresses in JavaScript, so I got this bugs.useState
can accept a function which returns an initial value, I can give a function to it in order to prevent this bug.https://codesandbox.io/s/slate-focus-bugs-8tsgy
In other cases, some custom plugins for Slate.js have an expensive process, so I made it to be memoized, but memoization shares the same value between caches. In the end, I stopped using memoization for these plugins.
We have a bit different issue. Again 2 different instances of editor but the problem is that when clicking focus directly from one to another both seem to loose focus.