Skip to content

Instantly share code, notes, and snippets.

@jfbloom22
Last active January 16, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfbloom22/abbd93fdc54305a951c1cdec11f4a383 to your computer and use it in GitHub Desktop.
Save jfbloom22/abbd93fdc54305a951c1cdec11f4a383 to your computer and use it in GitHub Desktop.
Accessible way to handle a React Bootstrap button click and avoid the focus border. Ref: https://github.com/react-bootstrap/react-bootstrap/issues/1300#issuecomment-386425763
onMouseDown={this.handleClick} onKeyUp={(e) => {if (e.keyCode === 13 || e.keyCode === 32) {this.handleClick()}}}
handleClick(e) { if (e) {e.preventDefault()}; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment