-
Notifications
You must be signed in to change notification settings - Fork 10
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
SearchField: Add onKeyUp prop #2326
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/wonder-blocks-search-field": minor | ||
--- | ||
|
||
Add onKeyUp prop to the `SearchField` component |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -72,6 +72,10 @@ type Props = AriaProps & { | |||||||||||
* Called when a key is pressed. | ||||||||||||
*/ | ||||||||||||
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => unknown; | ||||||||||||
/** | ||||||||||||
* Called when a key is released. | ||||||||||||
*/ | ||||||||||||
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => unknown; | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: I noticed we often deconstruct the specific props before applying it to the underlying element. Do we do that so that the remaining Here's an example where we do that with the other event handlers: wonder-blocks/packages/wonder-blocks-search-field/src/components/search-field.tsx Lines 126 to 130 in dd2759e
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct, we use that for aria props, and also for letting other valid attributes be injected in the inner node. I don't think there are drawbacks with that logic.... the only thing is that TS would complain, but this can be fixed by adding the missing props, like the one included here :). |
||||||||||||
/** | ||||||||||||
* Called when the element has been focused. | ||||||||||||
*/ | ||||||||||||
|
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.
praise: Thanks for cleaning this up!
I will also start removing descriptions from story argtypes as I go along so we can rely on the prop docs to avoid duplication 😄