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

Add onKeyDown property #161

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

SpawnAtis
Copy link

No description provided.

@iannbing iannbing changed the base branch from master to development April 10, 2020 19:44
children: JSX.Element | string;
up: () => void;
down: () => void;
left: () => void;
right: () => void;
enter: () => void;
onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => any;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function doesn't return any value, should it be (event: KeyboardEvent<HTMLDivElement>) => void?

@@ -27,7 +27,8 @@ export type TreeMenuProps = {
locale?: LocaleFunction;
matchSearch?: MatchSearchFunction;
disableKeyboard?: boolean;
};
onKeyDown?: () => any;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typing is inconsistent with the others. It should be onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void?

Copy link
Owner

@iannbing iannbing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Please change any to void, then I'd be happy to merge this PR.

@@ -167,6 +167,7 @@ Note the difference between the state `active` and `focused`. ENTER is equivalen
| initialActiveKey | set initial state of `activeKey`. Note that you need to provide the complete path (e.g. node-level-1/node-level-2/target-node). | string | - |
| initialFocusKey | set initial state of `focusKey`. Note that you need to provide the complete path (e.g. node-level-1/node-level-2/target-node). | string | - |
| onClickItem | A callback function that defines the behavior when user clicks on an node | (Item): void | `console.warn` |
| onKeyDown | A callback function that will be run after the keyboard navigation event | (event: KeyboardEvent<HTMLDivElement>) => any| - |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any should be void

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants