Lose my cursor position after page size changes

Viewed 29

I am using pagination on react-table. And everytime I change the page after clicking next. If the size of next page is less than the previous changes I lose my cursor position. Here is the snapshot for that.

enter image description here

Is there a way that I can place my cursor on the same button even if I have changed the page. so I dont lose my cursor and need to find the next button again.

I really appreciate your help.

1 Answers

One was could be to calculate your current mouse Y position when you click the button with MouseEvent, where the button will is after it moves up or down, and then 'scroll' the difference with window.scrollBy(X, Y).

There is probably a better way of doing it but this should also work i think.

Related