🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

filter-key

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filter-key

Exports functions to filter key events to specific keys. Helpful when creating keyboard-navigated UIs.

latest
Source
npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

filter-key

Exports functions to filter key events to specific keys. Helpful when creating keyboard-navigated UIs.

Usage

import {isClick} from 'filter-key'

// An accessible button rendered with a div
export const Button = ({onClick, ...props}) =>
  <div
    role='button' 
    tabIndex={0} 
    onClick={onClick} 
    onKeyPress={isClick(onClick)}
    {...props}
  />

Functions

isClick

Allows space and enter key events through. Helpful for mimicing a <button> tag

isEnter

Allows enter key events through. Helpful for mimicing an <a> tag

isSpace

Allows space key events through.

isEscape

Allows esc key events through.

isUp

Allows key up events through.

isDown

Allows key down events through.

isLeft

Allows key left events through.

isRight

Allows key right events through.

FAQs

Package last updated on 06 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts