Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support scrolling with Page Up / Page Down keys #46

Closed
steverandy opened this issue Aug 25, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@steverandy
Copy link

commented Aug 25, 2018

Currently scrolling with Page Up / Page Down is not possible after you click on the list item.

@bvaughn

This comment has been minimized.

Copy link
Owner

commented Aug 26, 2018

That's correct. Currently, you will need to implement this yourself adding a custom key event handler to a DOM element somewhere above list (or grid) and using the scroll-to API, e.g.:

// onKeyDown event listener added to an e.g. <div> that wraps list/grid
handleKeyDown = event => {
  switch (event.keyCode) {
    case 33: // page up
      this.listRef.current.scrollTo(
        this.state.scrollOffset - listHeight
      );
      break;
    case 34: // page down
      this.listRef.current.scrollTo(
        this.state.scrollOffset + listHeight
      );
      break;
};

// onScroll handler added to list
handleListScroll = ({ scrollOffset }) =>
  this.setState({ scrollOffset });

I don't think I want to build this into the library, but I'm not dead set against it. If you'd like to submit a PR (with docs and tests) to add it, I will be happy to review and give it consideration 😄

For now, I'm going to close this issue since I don't intend to take action on it though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.