-
Notifications
You must be signed in to change notification settings - Fork 10
fix: issue with events triggering twice in angular #4135
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
Conversation
🔭🐙🐈 Test this branch here: https://db-ux-design-system.github.io/core-web/review/fix-angular-double-events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes an issue where events for various UI components were triggering twice by adding event.stopPropagation() to multiple event handler functions.
- Added event.stopPropagation() to handlers in components such as textarea, tag, tabs, tab-item, switch, select, radio, notification, navigation-item, link, input, checkbox, card, and button to prevent duplicate event firing.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/components/src/components/textarea/textarea.lite.tsx | Added stopPropagation in input, change, blur, and focus handlers. |
packages/components/src/components/tag/tag.lite.tsx | Prevents event propagation in the remove handler. |
packages/components/src/components/tabs/tabs.lite.tsx | Stops propagation in the change event handler. |
packages/components/src/components/tab-item/tab-item.lite.tsx | Added stopPropagation to the change event handler. |
packages/components/src/components/switch/switch.lite.tsx | Inserts stopPropagation in change, blur, and focus handlers. |
packages/components/src/components/select/select.lite.tsx | Prevents propagation in click, input, change, blur, and focus events. |
packages/components/src/components/radio/radio.lite.tsx | Stops propagation in change, blur, and focus handlers. |
packages/components/src/components/notification/notification.lite.tsx | Adds stopPropagation in the close handler. |
packages/components/src/components/navigation-item/navigation-item.lite.tsx | Inserts stopPropagation in click handler. |
packages/components/src/components/link/link.lite.tsx | Stops propagation in the link click handler. |
packages/components/src/components/input/input.lite.tsx | Prevents propagation in input, change, blur, and focus events. |
packages/components/src/components/checkbox/checkbox.lite.tsx | Stops propagation in change, blur, and focus handlers. |
packages/components/src/components/card/card.lite.tsx | Inserts stopPropagation in the click handler. |
packages/components/src/components/button/button.lite.tsx | Added stopPropagation in the button click handler. |
Comments suppressed due to low confidence (14)
packages/components/src/components/textarea/textarea.lite.tsx:92
- [nitpick] Ensure that stopping event propagation here does not unintentionally block necessary parent handler processing; consider adding a comment to clarify the intent for future maintainability.
event.stopPropagation();
packages/components/src/components/tag/tag.lite.tsx:24
- [nitpick] Review the use of optional chaining with stopPropagation to ensure consistency with other handlers and document the reasoning if the event can be undefined.
event?.stopPropagation();
packages/components/src/components/tabs/tabs.lite.tsx:141
- [nitpick] Confirm that stopping propagation in the tab change handler does not interfere with any related parent or global scroll handling logic.
event.stopPropagation();
packages/components/src/components/tab-item/tab-item.lite.tsx:44
- [nitpick] Verify that the stopPropagation in the tab-item change handler is safe and consider documenting why it is necessary in the component context.
event.stopPropagation();
packages/components/src/components/switch/switch.lite.tsx:43
- [nitpick] Review the insertion of stopPropagation in the switch’s change handler to ensure that it does not disrupt expected parent event flows.
event.stopPropagation();
packages/components/src/components/select/select.lite.tsx:98
- [nitpick] Double-check that adding stopPropagation in the select's click handler does not affect any intended higher-level event processing, and document the fix for clarity.
event.stopPropagation();
packages/components/src/components/radio/radio.lite.tsx:33
- [nitpick] Ensure that stopping event propagation in the radio change handler does not interfere with any other component logic relying on the event bubbling.
event.stopPropagation();
packages/components/src/components/notification/notification.lite.tsx:24
- [nitpick] Review the use of stopPropagation in the notification close handler to ensure that it does not suppress any necessary global notification closing events.
event.stopPropagation();
packages/components/src/components/navigation-item/navigation-item.lite.tsx:53
- [nitpick] Confirm that stopping event propagation in the navigation item click handler is intentional and does not block any higher-level navigation-related actions.
event.stopPropagation();
packages/components/src/components/link/link.lite.tsx:21
- [nitpick] Verify that preventing propagation in the link click handler does not hinder any analytics or parent component interactions that rely on event propagation.
event.stopPropagation();
packages/components/src/components/input/input.lite.tsx:103
- [nitpick] Ensure that the addition of stopPropagation in the input handler does not block necessary parent event handling, and add comments where needed for clarity.
event.stopPropagation();
packages/components/src/components/checkbox/checkbox.lite.tsx:88
- [nitpick] Confirm that preventing event propagation in the checkbox change handler is safe and correctly documented for future maintainers.
event.stopPropagation();
packages/components/src/components/card/card.lite.tsx:20
- [nitpick] Ensure that stopping event propagation in the card click handler does not interfere with card selection or parent event listeners that may be critical.
event.stopPropagation();
packages/components/src/components/button/button.lite.tsx:25
- [nitpick] Double-check that stopping propagation in the button click handler is in line with the intended event flow, and consider a brief comment to document the behavior.
event.stopPropagation();
Proposed changes
closes #4066
Types of changes
Further comments