Closed stuartflanagan closed 5 years ago
Hi!
To solve this use case we usually save the “last focused row/item” in the parent state (e.g. redux) when the page is unmounted. Then when mounted again, we focus that element by its row/item indices. To do that we also need to know focus keys, so remember to set them for each row and item. Since this logic is out of scope of this library, this needs to be handled by the application. This library remembers last focused elements only within one lifecycle.
Closing this as answered, please feel free to reopen if you need more help.
I have a small application set up at the moment with some routing in place to navigate screens. Just using
react-router: 5.0.0
at the moment.My question is on how I might retain state of focus between component rendering. If I am on a category page with some rows like your example application and I navigate away from this screen does the inbuilt focus state persistence of child components still function?
I am asking as i am having trouble getting this to remember focus state of parents and child components when returning from another route.
Thanks for all the work you have put into this library.