-
Notifications
You must be signed in to change notification settings - Fork 28
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
Simple idea for dealing with focus problem #12
Comments
|
Could be my lack of understanding, but I'm not sure I follow your point. My thinking was that each As far as I can see, the only consistent way to uniquely identify an element between renders would be via a unique id. We could use |
While capturing the focused element is certainly possible within the reducer, there's currently no way to hook into the inner workings of the store's #13 looks like a simple work-around. Thanks for submitting it. Let me think about it for a bit and I'll get back to it tomorrow. |
I submitted #15 as an alternative solution. In a way it's a more generalized #13. Rather than re-focusing inside of the @bsouthga I'm curious to hear your thoughts on this approach! |
Nice! I like the use of |
The render event gives the users of innerself a hook to add custom logic after the render is complete. It allows to restore focus, selection and caret positions after render. Fixes #12.
This fix will solve the focus problem in text inputs. However if we put an |
In that case, might be a better idea to have those elements outside of the innerself render area. Additionally, assuming you are using this to make an app, it should be possible to create multiple roots as independent renders. That being said, I'm not sure the current state implementation allows for multiple roots. |
It does! But I think the trouble is that as soon as you use innerself for some kind of routing (e.g. a tabbed interface), you can't really |
Right. What I felt is for making something like a video player or audio player, innerself wouldn't be the ideal choice. There'll be a lot more hacking and workarounds than required. Simple text based applications should be the ideal candidates for this. |
@wrick17 Absolutely. I wrote it with a specific use-case in mind and I'm first to admit that it's not a versatile multitool, like React :) |
And that's what I like about this library. It does one thing, and does that amazingly. Appreciate it!! |
Really cool project!
Simple idea with issue of losing focus -- we could check for an active element that has an id before each render and try to refocus after, basically giving people the option of adding unique ids to elements they want to keep focused between renders:
https://github.com/bsouthga/innerself/blob/maintain-focus/index.js#L22
Thoughts?
The text was updated successfully, but these errors were encountered: