freshworks/crayons

[Bug] - Disabled button still fires the onclick method attached to it

Opened this issue · 1 comments

Component
fw-button - https://crayons-next.freshworks.com/components/core/button/

Describe the bug
Disabled button still fired the onclick method attached to it.

To Reproduce
Attaching the recording for reference below

Screen.Recording.2023-04-25.at.3.16.07.PM.mov

Expected behavior
The disabled button should not trigger onclick method attached to it.

@AadhavanVA
Can we make onclick = null, when assigning the disable attribute to the button?

function disableButton() { myButton.setAttribute('disabled', true); myButton.onclick = null; }

Or can we use css property here for making that disable ?
style="pointer-events: none;"