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

arrow key should work only if the component is focused #80

Closed
BesatZardosht opened this issue Aug 16, 2016 · 2 comments
Closed

arrow key should work only if the component is focused #80

BesatZardosht opened this issue Aug 16, 2016 · 2 comments
Labels

Comments

@BesatZardosht
Copy link

Thanks for amazing component!
being able to use arrow keys to change slides is great however, it should be disable if the component is not focused.

@xiaolin
Copy link
Owner

xiaolin commented Aug 19, 2016

That might not always be desired. If you are running into conflicts with keydown events you can add a wrapper to ImageGallery and toggle disableArrowKeys, see below.

  _enableArrowKeys() {
    this.setState({disableArrowKeys: false});
  }

  _disableArrowKeys() {
    this.setState({disableArrowKeys: true});
  }


render() {
  return (
    <div
      onMouseOver={this._enableArrowKeys.bind(this)}
      onMouseLeave={this._disableArrowKeys.bind(this)}
    >
      <ImageGallery disableArrowKeys={this.state.disableArrowKeys}/>
    </div>
  );
}

Note: Toggling disableArrowKeys was just release and only works on 0.6.8

@xiaolin
Copy link
Owner

xiaolin commented Aug 24, 2016

Closing this as a wontfix, feel free to reopen if you have any questions.

@xiaolin xiaolin closed this as completed Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants