fix(CardHorizontla): 🐛 button event bubbling (double onClick)#998
fix(CardHorizontla): 🐛 button event bubbling (double onClick)#998
Conversation
🦋 Changeset detectedLatest commit: a1df536 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
f6c27a5 to
1565af1
Compare
The inner Button component was using the same handleClick handler as the parent Wrapper, causing event bubbling that invoked onButtonClick and window.open(infoUrl) twice when the button was clicked. Added a new handleButtonClick wrapper that calls e.stopPropagation() before invoking the main handleClick, preventing the event from bubbling to the parent Wrapper. Fixes the bug reported in CardHorizontal.tsx:285
116c061 to
6930444
Compare
📚 Storybook Preview Deployed✅ Preview URL: https://click-iru2kt44d-clickhouse.vercel.app Built from commit: |
This has already been addressed in a separate PR, which is pending approval. Do ignore! |
Took a note and will be looked at in future refactoring. Do ignore! |
|
Claude finished @punkbit's task in 1m 3s —— View job PR Review
Solid fix, well-tested, and cleanly scoped. Here's the full review: 🟢 Fix is correct The two-handler pattern is sound:
🧪 Tests are solid The two new regression tests ( 📦 Changeset Patch-level changeset is appropriate — concise description is fine for a bug fix per 💡 Pre-existing issues (out of scope, already acknowledged)
✅ Ready to merge. The bug is fixed, tests cover the regression, and the changeset is in place. |
Noted and will be taken care of in next iterations. Do ignore! |
Why?
To fix
CardHorizontaldoubleonClickhandler bug, where clicking the inner Button would invokeonButtonClickand window.open(infoUrl) twice due to event bubbling. Fixed by adding event stop propagation method to the button's click handler.How?
Tickets?
N/A
Contribution checklist?
buildcommand runs locallyPreview?
N/A