freshworks / crayons

🖍️ Crayons - A UI Kit comprising of web components for building Freshworks Apps!
https://crayons.freshworks.com
219 stars 61 forks source link

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

Open AadhavanVA opened 1 year ago

AadhavanVA commented 1 year ago

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

https://user-images.githubusercontent.com/81296340/234239618-b8dfd833-cde0-4c83-8889-f2fbb5ff9c7c.mov

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

mayhsundar commented 1 year ago

@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;"