[utils] Fix event handling in useEnhancedClickHandler#3981
[utils] Fix event handling in useEnhancedClickHandler#3981atomiks merged 2 commits intomui:masterfrom
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| if ('pointerType' in event) { | ||
| // Chrome and Edge correctly use PointerEvent | ||
| handler(event, event.pointerType); | ||
| } else { |
There was a problem hiding this comment.
Added this else block after line 39 to prevent the handler from being
called twice per click.
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Greptile OverviewGreptile SummaryFixed a bug in
Confidence Score: 5/5
Important Files Changed
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the useEnhancedClickHandler function where the handler was being called twice when the event contained a pointerType property. The issue was that the fallback handler call was not wrapped in an else block, causing it to execute unconditionally after the conditional call.
Changes:
- Fixed the event handling logic by adding an
elseblock to ensure only one handler call occurs per click event
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fix event handling in useEnhancedClickHandler to support pointerType