-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Bug]: TableToolbarSearch is calling onChangeProp with incorrect parameters when there is a default value #14655
Comments
Thanks for reporting this! Here's the relevant source you're referring to: carbon/packages/react/src/components/DataTable/TableToolbarSearch.tsx Lines 179 to 187 in 0d75092
Since the dependency array is empty, this is only ran once, after the initial render. What event would you expect |
@tay1orjones - Thank you for your quick response. I discussed this with my colleague and we have the following thoughts:
Since the current implementation is broken and calls onChange with an empty string instead of an event, consumers are probably not relying on this handler being called when TableToolbarSearch is mounted with a default value. |
I agree, that's also consistent with how onchange events work on native HTML elements.
Unfortunately, I'm guessing the opposite, that some code uses the initial onChange() call to trigger a search on the default value. And that code would break if we just dropped the initial onChange() call. In other words, I agree with dropping the initial onChange() call but it seems like you would need to wait until Carbon 12. Likewise for replacing the null-like event object with a custom event. |
Just to add another five cents of context into this, please make sure to back port to the 7.* version line. We are now on |
Package
carbon-components-react
Browser
No response
Package version
v7.59.8
React version
v16.14.0
Description
In TableToolbarSearch.js, it is calling onChangeProp with two strings instead of an event as expected when a default value is specified.
As a result the onChange handler is passed '' instead of an event with a target value.
Reproduction/example
N/A
Steps to reproduce
Suggested Severity
Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.
Application/PAL
IBM Knowledge Catalog (formally Watson Knowledge Catalog)
Code of Conduct
The text was updated successfully, but these errors were encountered: