Closed stuartflanagan closed 1 year ago
Any updates on how this can be achieved from the API would be very helpful
Hi! This is on our radar, we also had some use cases where we need to know the focus key of currently focused item (or other information about it). So I hope it will be added soon.
Thank you for responding! I will keep an eye out.
Hi, any news on this topic? Thanks
Hi,
Sorry, nothing new so far, as we still didn't have real use case where we need to know the currently focused item. Usually the item itself getting focused
flag is more than enough. Or in case of parent items - hasFocusedChild
.
But feel free to make a PR. There is similar PR #52 however it implies exporting the whole instance of SpatialNavigation, which could be a bit dangerous since you can basically execute any method from it manually as there are no "private" methods then. So perhaps the better solution would be to export simple method that will get currently focused item, together with the global methods exported from the lib like initNavigation
etc. from index.js
.
Is your feature request related to a problem? Please describe. A way to find the currently focused item. This may already be available I am just not sure of the API to surface it sorry.
Describe the solution you'd like
SpatialNavigation.currentlyFocusedItem()
I am trying to find a way to get the currently focused item to return to after certain warnings or actions.
Is there a way to retrieve the current
withFocusable
item that is in focus from the library?