Turn off the Change Focus Window on reload ? #17352
Replies: 6 comments 2 replies
-
|
I don't think Vite is triggering this behaviour by default. Do you have code that would re-focus the window, in which HMR would re-trigger that code? |
Beta Was this translation helpful? Give feedback.
-
|
Fantastic question: // vite.config.js
export default {
build: {
outDir: './dist'
},
server: {
hmr: { overlay: false }
}
}
It looks like this behavior does not exist in chrome, it doesn't force window focus (And move cursor in the case of My window manager.) |
Beta Was this translation helpful? Give feedback.
-
|
@Charles-Schleich did you find a way to keep focus window in your editor? |
Beta Was this translation helpful? Give feedback.
-
|
Is there really no resolution to this? This issue is beyond annoying. It makes HMR useless. It even switches tabs in my browser as I'm trying this message. |
Beta Was this translation helpful? Give feedback.
-
|
I think I found a clue – do you happen to use For me, that's what's causing the browser to jump into focus, but only in some conditions. Try putting this snippet into the console and switch away to a different application – My results:
Same for I think this proves that:
|
Beta Was this translation helpful? Give feedback.
-
|
I'm aware this likely won't help most of you, but I ran into this issue as well. In my case I got it fixed by simply doing For some reason I had this combination of:
Note: We use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
While Running
vite --config vite.config.jsupon saving a file in VSCode, the window focus changes from my Code Editor to my Browser.
How do i disable this behavior ?
Beta Was this translation helpful? Give feedback.
All reactions