Closed probablykasper closed 1 month ago
What would be the alternative? Got something to propose?
As it does not stop the functionality and it can be worked around rather easily. But if you have an idea of how to improve it and the DX, sure.
As it is only happening when trying to screenshot a sveltekit app in dev mode the issue is rather minor IMO. Just tried it on my ma you can work around it by:
But again, what would be a good alternative ?
It might be best to figure out a different default shortcut to avoid conflicts. I think it's important enough because it's common to take frequent screenshots for clients/coworkers/feedback
Something that would help a bit is to handle it like this:
on cmd+shift keydown: enable inspector
before cmd+shift keyup is fired:
on cmd+shift+[another key/modifier] keydown: disable inspector
There's a way to set a custom key combination for the inspector: https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#inspector Hope this helps.
I think cmd+alt
would be a sensible default for it. That does not conflict with any default OS shortcuts
got annoyed by this myself, here's a slight change in behavior based on https://github.com/sveltejs/vite-plugin-svelte/issues/557#issuecomment-1355603720
would be great if you could try #716 to see if it works on mac @probablykasper
Unfortunately it doesn't fix it because the cmd+shift+(3|4|5)
shortcuts never reach the browser in the first place - not even keyup or window blur. That's why the inspector gets stuck being open.
This problem is pretty specific to those shortcuts. I don't know any other shortcut with this problem, so combinations like alt-shift
work well (I use that one). Even if any other shortcuts have this problem, it wouldn't be as annoying/frequent as with screenshots.
Your PR still helps with other cases though, nice work!
released svelte-inspector 1.0.4 with the improvements. That cmd-shift-(3,4,5) don't trigger key events and also don't cause onLeave leave us no room for detecting it.
In this case there are 2 workarounds: 1) enable svelte inspector first, then use the screenshot combo which would disable svelte-inspector again 2) use a different combo
In the next major release we might reconsider the default shortcut for macos if more users raise their annoyance.
the new default is alt-x
for all platforms in the next major of svelte-inspector, you can try it today with version 3.0.0-next.4, which is publishing as i type this. see #995
Describe the bug
I frequently take screenshots, which on macOS is done using
cmd+shift+3/4
. When I do that, the inspector shows up and photobombs my screenshot, then it stays active afterwards.It's a bit disorienting to me because after pressing
cmd+shift+4
I now need to remember to do a separate shortcut to hide the inspector (I found myself tryingEscape
a lot).https://user-images.githubusercontent.com/11315492/208026596-05fc8dff-6d07-4b08-9c8f-f699fd37ecd5.mp4
Reproduction URL
Not applicable here imo
Reproduction
npm create svelte
inspector
insvelte.config.js
:npm i && npm run dev
cmd+shift+4
Logs
No response
System Info