daybrush / infinite-viewer

Infinite Viewer is Document Viewer Component with infinite scrolling.
https://daybrush.com/infinite-viewer/
MIT License
283 stars 30 forks source link

Question: How to prevent scroll from keyboard? #37

Open ryantando opened 1 year ago

ryantando commented 1 year ago

Hi, I wanted to move an element with the keyboard but it affects the infinite scroll. I was wondering how to prevent the infinite scroll to moved while clicking up/down/left/right on the keyboard?

Thanks

daybrush commented 1 year ago

@ryantando

It must be blocked through an external key manager.

InfiniteViewer does not block events separately.

document.body.addEventListener("keydown", e => {
    // move key
   e. preventDefault();
});