# Disabled button still clickable

**URL:** <https://discourse.nodered.org/t/disabled-button-still-clickable/67060>\
**Category:** Developing Nodes\
**Created:** [29 August 2022 11:43 UTC](https://discourse.nodered.org/t/disabled-button-still-clickable/67060 "2022-08-29T11:43:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nileio](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nileio/32/9444_2.png) [@nileio](https://discourse.nodered.org/u/nileio)\
**Post date:** [29 August 2022 11:43 UTC](https://discourse.nodered.org/t/disabled-button-still-clickable/67060/1 "2022-08-29T11:43:56Z")

</div>

Hi team,  
I noticed a behaviour while developing a new node and using the `button` attribute  
[https://nodered.org/docs/creating-nodes/appearance#buttons](https://nodered.org/docs/creating-nodes/appearance#buttons)  
the node has a button defined like this

```auto
visible: function () {
	return !this.changed
			},
enabled: function () {
	return !this.changed && this.nodeState !== 0 && this.nodeState !== 2
}

```

now `enabled` surely returns `false` . The button visually "looks" disabled, that is dimmed greyed out, and and the mouse arrow does not show as a clickable rect, however, when the rect is clicked anywhere inside the button, the action attached to the click is actually executed!  
The expected behavior is that the click action is never invoked if the button is disabled.  
I verified this as I have an admin API attached to button click.

```auto
Node-RED version: v3.0.2
Node.js version: v14.20.0

```

Update:I dont know if this is by design! I just noticed that the Inject node actually has the same behaviour. When added to the workspace, the button is disabled however it is still clickable! I dont believe it was the case in previous versions.  
Here is the button definition from the core Inject node. Wondering why the `onclick` function still `doInject` , shouldnt this be an `if ... else` instead ??

```auto
button: {
            enabled: function() {
                return !this.changed
            },
            onclick: function () {
                if (this.changed) {
                    return RED.notify(RED._("notification.warning", { message: RED._("notification.warnings.undeployedChanges") }), "warning");
                }
                doInject(this);
            }

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 October 2022 11:44 UTC](https://discourse.nodered.org/t/disabled-button-still-clickable/67060/2 "2022-10-28T11:44:14Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
