lxsmnsyc/terracotta

TypeError: Cannot read properties of undefined (reading 'matches')

vincentfretin opened this issue · 2 comments

solid-headless 0.12.1
I copied the Dialog demo in my app.
I have an issue with this code https://github.com/LXSMNSYC/solid-headless/blob/983581b93fc06169325703c8b0aa734ff349924a/packages/solid-headless/src/utils/focus-navigation.ts#L18

anchor is -1, so nodes[anchor] is undefined and so isFocusable(nodes[anchor]) is crashing with TypeError: Cannot read properties of undefined (reading 'matches')

From the logic in this code, I think you meant to use nodes[current] instead of nodes[anchor]

Oh yeah, good catch