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

[Bug]: Slider, onRelease and onBlur #12187

Closed
2 tasks done
stanley-regnard opened this issue Sep 28, 2022 · 3 comments · Fixed by #12254
Closed
2 tasks done

[Bug]: Slider, onRelease and onBlur #12187

stanley-regnard opened this issue Sep 28, 2022 · 3 comments · Fixed by #12254

Comments

@stanley-regnard
Copy link
Contributor

Package

@carbon/react

Browser

Chrome

Package version

1.13.0

React version

18.2.0

Description

When typing in the TextInput attached to a Slider, each character typed will trigger the onRelease function.
Exiting the same TextInput will result in a error logged in the browser console:

Uncaught TypeError: _this.props.onBlur is not a function
    at @carbon_react.js?v=0c3423c8:65038:19
    at HTMLUnknownElement.callCallback2 (chunk-HSVJWAOT.js?v=7bb9af7f:3793:22)
    at Object.invokeGuardedCallbackDev (chunk-HSVJWAOT.js?v=7bb9af7f:3818:24)
    at invokeGuardedCallback (chunk-HSVJWAOT.js?v=7bb9af7f:3852:39)
    at invokeGuardedCallbackAndCatchFirstError (chunk-HSVJWAOT.js?v=7bb9af7f:3855:33)
    at executeDispatch (chunk-HSVJWAOT.js?v=7bb9af7f:6484:11)
    at processDispatchQueueItemsInOrder (chunk-HSVJWAOT.js?v=7bb9af7f:6504:15)
    at processDispatchQueue (chunk-HSVJWAOT.js?v=7bb9af7f:6513:13)
    at dispatchEventsForPlugins (chunk-HSVJWAOT.js?v=7bb9af7f:6521:11)
    at chunk-HSVJWAOT.js?v=7bb9af7f:6645:20

Reproduction/example

https://stackblitz.com/edit/github-h8unbj?file=src%2FApp.jsx

Steps to reproduce

If you use the Slider, onChange and onRelease values should update as expected.
While typing in the TextInput, you would notice that both onChange and onRelease values will be edited live.
Exiting the TextInput should trigger an error in the console.

Code of Conduct

@jnm2377
Copy link
Contributor

jnm2377 commented Sep 28, 2022

Can confirm I am also seeing this error in our storybook.

@stanley-regnard
Copy link
Contributor Author

It looks like #12207 should fix the error with onBlur
However that probably shouldn't close this issue, there's still the (more problematic) bug with onRelease being triggered by the TextInput

@abbeyhrt
Copy link
Contributor

abbeyhrt commented Oct 4, 2022

@stanley-regnard Agreed, there are kind of two bugs here, what's going on with onBlur that is resolved by #12207 and onRelease being called when it shouldn't. We'll adjust the other PR to not close this one

@kodiakhq kodiakhq bot closed this as completed in #12254 Oct 7, 2022
Repository owner moved this from ⏱ Backlog to ✅ Done in Design System Oct 7, 2022
kodiakhq bot added a commit that referenced this issue Oct 7, 2022
* fix(react): added condition check before calling onblur. closes #12187

* fix(slider): update conditional onBlur call

* chore(slider): remove testing code

* chore(slider): formatting

Co-authored-by: Taylor Jones <taylor.jones826@gmail.com>
Co-authored-by: TJ Egan <tw15egan@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants