Keyboard navigation is out-of-sync from viewstate
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
when opening a folder in the tree using the right-arrow, and then move down, the focus is on the item after the tree item, IF the ‘items’ of the tree are the same. when the items change as well (for instance items keeping track of expand state as well) then it works fine.
To Reproduce Steps to reproduce the behavior:
- visit: https://rct.lukasbach.com/docs/guides/controlled-environment/#managing-the-view-state-of-the-tree
- Click ‘Desserts’ (it should expand immediately)
- Press arrow down (focus becomes “Drinks”)
Expected behavior A clear and concise description of what you expected to happen.
- visit: https://rct.lukasbach.com/docs/guides/controlled-environment/#managing-the-view-state-of-the-tree
- Click ‘Desserts’ (it should expand immediately)
- Press arrow down (focus should become “Cookies”)
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: MacOS
- Browser: Chrome
- Version: 102
Additional context Add any other context about the problem here.
I could fix this behaviour in my own application by updating the object reference of items
whenever the expanded view state changed. I suspect there the keyboard navigation is somehow using an out of date ‘linear list’ because it only updates when the ‘items’ change, and not when the ‘expandedItems’ state changes.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
It works perfectly now! Thank you! (will update the online build later)
Thanks, that really was helpful in debugging, I believe I found the issue now. Please try again with RCT version 1.1.8, I hope this time there are no other problems 😅 Let me know if you have any other issues, and btw your project looks awesome! 😃