Commit a750794
Fix Tooltip onClick handler invocation bug (#14075)
## Summary
Fixed a bug in the Tooltip component where the onClick handler was being
invoked immediately instead of being passed as a reference to the child
element.
## Key Changes
- Removed the function invocation operator `()` from `onClick()` to
`onClick` in the Tooltip component
- This ensures the onClick handler is properly retrieved as a function
reference rather than being called during the assignment
## Implementation Details
The bug was in the onClick handler extraction logic where
`children.props?.onClick()` was immediately invoking the function and
assigning its return value. The fix changes this to
`children.props?.onClick`, which correctly retrieves the function
reference so it can be called later with the proper event context via
`originalOnClick(event)`.
This prevents unintended function execution and ensures the original
onClick handler is invoked at the appropriate time with the correct
event object.
https://claude.ai/code/session_019WWv3CGtetHF8EPZRaa5Tp
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2ec3349 commit a750794
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
0 commit comments