How to scroll the list using arrowkeys?

I have a search box and search result. on keypress the mouse cursor moves but it goes beyond the searchresult container without moving the list. So I want to know how can I scroll the list along with the cursor.

after lot of research, I have come to understand that it can be achieved using refs but I don’t understand them well.

i have tried this code and it moves the entire page while I need to move just search results

myRef.current.scrollIntoView()  

Note : I am not using any library. Just building from scratch.

Not sure if this is just me, but I am struggling to understand the question. For example what is a search box? (Do you mean textarea?)
Or what is a search result? You said “scroll the list” but what did you mean?

you might have seen searchboxes on most of the websites to search item. It’s just an input and on entering the value it shows suggestions like google. Just refer the google searchbox

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.