Skip to content

Commit

Permalink
Merge pull request #6815 from CitizenLabDotCo/allow-passing-onKeyDown…
Browse files Browse the repository at this point in the history
…-event

Allow passing onKeyDown on Input
  • Loading branch information
EdwinKato authored Jan 15, 2024
2 parents e518739 + fc42ffe commit 2c1bc15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cl2-component-library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cl2-component-library/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.11.25",
"version": "0.11.27",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion cl2-component-library/src/components/Input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent, FormEvent } from 'react';
import React, { PureComponent, FormEvent, KeyboardEvent } from 'react';
import { isNil, isEmpty, size as lodashSize, isBoolean } from 'lodash-es';

// components
Expand Down Expand Up @@ -76,6 +76,7 @@ export interface InputProps {
onFocus?: (arg: FormEvent<HTMLInputElement>) => void;
onBlur?: (arg: FormEvent<HTMLInputElement>) => void;
setRef?: (arg: HTMLInputElement) => void | undefined;
onKeyDown?: (event: KeyboardEvent) => void;
autoFocus?: boolean;
min?: string;
max?: string;
Expand Down Expand Up @@ -132,6 +133,7 @@ class Input extends PureComponent<InputProps> {
ariaLabel,
a11yCharactersLeftMessage,
className,
onKeyDown,
} = this.props;
const {
id,
Expand Down Expand Up @@ -198,6 +200,7 @@ class Input extends PureComponent<InputProps> {
readOnly={readOnly}
required={required}
autoComplete={autocomplete}
onKeyDown={onKeyDown}
{...optionalProps}
/>

Expand Down

0 comments on commit 2c1bc15

Please sign in to comment.