[CTASection]: passing Onclick to the cta does not work
KIQsco opened this issue · 2 comments
Detailed description
I'm trying to use the CTA Section component, with CTA as a button. The buttons work properly except for the onClick property, that seems to be ignored. This is how I'm calling the component:
<CTASection {...props.contentBlockProps} cta={{ style: "button", type: "local", buttons: [{ type: "local", copy: "CTA 1", onClick: () => console.log(true) }] }} />
https://www.ibm.com/standards/carbon/react/?path=/story/components-cta-section--default
I used a similar approach in the LeadSpace component and it works fine.
Could you help me figured out this issue, please?
Inspecting the CTASection component code, on the "@carbon/ibmdotcom-react" package, seems that the prop type for "onClick" is not there
General
CTA Section component
The onClick should work as on the cta on leadspace
Google Chrome
looks like the onClick is being overwritten here: https://github.com/carbon-design-system/carbon-for-ibm-dotcom/blob/master/packages/react/src/components/CTA/ButtonCTA.js#L79
Opening this ticket in the main carbon-for-ibm-dotcom repo here: carbon-design-system/carbon-for-ibm-dotcom#6844