Dominic Gannaway
Dominic Gannaway
This is something that also was not working in Svelte 4. Specifically, the script element has already loaded from SSR and when hydration occurs, the event listener gets added too...
Why do we need this? You can just check if something is focused by using `document.activeElement`.
Write access is tricky with focus. If you try to bind focus to two elements by accident, you cause so many issues with accessibility. It's much better to handle focus...
Sorry, I don't think this is something we want to invest our time into now. Like I said, focus is complicated and easy to mess up and hard to debug...
Actually, I think this would be best if it was read-only, rather than writable. Then I can see a way forward for the PR too :)
@RaiVaibhav Sure, go for it :)
This has been fixed.
Update: I'm still not happy with this (I pushed some fixes but they're not right still). It turns out that this is far more complicated to get right. Here is...
@xamir82 This is fixed now :)
This is complicated. This is only true of primitive state, but for deeply nested state, it's the only way some patterns can work unless you invoke effects to sync state...