bumbeishvili / org-chart

Highly customizable org chart. Integrations available for Angular, React, Vue
https://stackblitz.com/edit/web-platform-o5t1ha
MIT License
928 stars 330 forks source link

Pointer events no longer working when I click the descendants button #330

Closed seanpmaxwell closed 1 year ago

seanpmaxwell commented 1 year ago

Describe the bug I need to fire a JavaScript event when the descendants button is clicked. I used to be able to do that in previous versions by doing document.addEventListener('click', (e) => e.target.closet('.node-button-g') ...do stuff). But now it looks like pointer events for the descendants button are disabled. It still works when I click inside the node just not the button.

Additional context Please re-enable pointer events or what would be even nice would be to have a callback that is fired when the button is clicked. I noticed there is a onButtonClick function but that does not have a callback and looks more like a way to manually click the button.

bumbeishvili commented 1 year ago

@seanpmaxwell I don't remember disabling pointer events, I added stopPropagation method though, because it was causing a bug in Safari

https://github.com/bumbeishvili/org-chart/issues/290

You can use a new method, called onExpandOrCollapse to do the same stuff

chart.onExpandOrCollapse((d) => {
   // do stuff
})
seanpmaxwell commented 1 year ago

Thanks onExpandOrCollapse is just what I needed. yeah it was prob the stopPropagation which cause it to no longer work.