T
TanStack10mo ago
automatic-azure

implementing keyboard nav perf

i've found the easiest way to add arrow keys and j/k nav to my table is to do it in listeners per row. it is basically just the simplest code to write i assume there's perf implications to this? attaching this listener per row is probably not a great idea i assume. am i overthinking the importance of this? or is there a more ergonomic way to handle this?
2 Replies
conscious-sapphire
conscious-sapphire10mo ago
I'm also curious to know about arrow key nav! Following & will update once I get to dig into it myself
automatic-azure
automatic-azureOP10mo ago
if it helps, what i'm doing right now is in a handler on the tablebody, i listen for keys i want to handle up/down nav then i grab target, and walk upwards until i find a 'tr'. then focus the next/previousElementSibling running into a bunch of other issues though. opening/closing a dialog wipes focus entirely which is a big issue i'm trying to solve. Would be nice if there was a native solution here.

Did you find this page helpful?