-
Notifications
You must be signed in to change notification settings - Fork 48
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
base: development
Are you sure you want to change the base?
Conversation
children: JSX.Element | string; | ||
up: () => void; | ||
down: () => void; | ||
left: () => void; | ||
right: () => void; | ||
enter: () => void; | ||
onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => any; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
?
There was a problem hiding this 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| - | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any
should be void
No description provided.