infor-design / enterprise-wc

Enterprise-grade web component library for the Infor Design System
Apache License 2.0
27 stars 26 forks source link

General: Multiple duplicated events happening #2280

Open fabiojpoli opened 5 months ago

fabiojpoli commented 5 months ago

I have tested multiple components and noticed that event like "click" is happening twice or three times sometimes, on the body of the components or label when I am clicking once. These events happening more than one time is causing loops for the application where we are using for specific cases.

To Reproduce Bellow is the list of some components I have tested (describing how many times the click is being called and where is being clicked specifically), which to reproduce is basically this code on console:

$0.addEventListener('click', () => {
  console.log('clicked')
});

3 times on label or input: https://main.wc.design.infor.com/ids-radio/example.html 3 times on label or input: https://main.wc.design.infor.com/ids-checkbox/example.html twice on label: https://main.wc.design.infor.com/ids-date-picker/example.html 3 times on label and twice on input: https://main.wc.design.infor.com/ids-input/example.html twice on label: https://main.wc.design.infor.com/ids-progress-bar/example.html twice on input: https://main.wc.design.infor.com/ids-spinbox/example.html twice on label or input: https://main.wc.design.infor.com/ids-switch/example.html twice on label: https://main.wc.design.infor.com/ids-textarea/example.html twice on label: https://main.wc.design.infor.com/ids-time-picker/example.html twice on folder icon: https://main.wc.design.infor.com/ids-upload/example.html twice on upload link: https://main.wc.design.infor.com/ids-upload-advanced/example.html

Expected behavior Call the click event only once, one call per click.

Version Latest

Screenshots Screen Shot 2024-05-01 at 4 21 37 PM

tmcconechy commented 5 months ago

In general a lot of these components dont really have a click event as part of them. I guess whats happening is the elements are propagating the click in the subtree of it.

We can take a look but may want to consider other events like for example change/input on checkboxes.

fabiojpoli commented 5 months ago

Thanks. I need a click event to select the component in a desginer form builder where we add components and click on top of it to select the item.

tmcconechy commented 5 months ago

ok i guess they should have a click event.. Will work on this when we can

inforandy commented 3 months ago

will schedule a fix for this one by september