onClick firing for disabled buttons in v15.4.0
See original GitHub issueWith the latest 15.4.0 ReactJS release, onClick
is now firing for disabled button
elements which have child HTML elements:
https://jsfiddle.net/rcataldo/69z2wepo/62589/
In the previous ReactJS version, the onClick handler would not be called.
Note that onClick is not called if I remove the <span>
from the button.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:11
- Comments:19 (11 by maintainers)
Top Results From Across the Web
Disabled button still fires using ".click()" - Stack Overflow
The attribute only disables user interaction, the button is still usable programmatically. So yeah, you gotta check
Read more >react disable onclick conditional - You.com | The AI Search ...
onClick firing for disabled buttons in v15.4.0 · Issue #8308 ... ... Nov 16, 2016 ... In the previous ReactJS version, the onClick...
Read more >disabled button on a page does not fires click event - MSDN
I am using a button on my page which is having onclick and onclienclick event both.on clientclick i disable that button but after...
Read more >How to disable a button in JavaScript - Educative.io
In the code above, we created two buttons. We click the second button to disable or enable the first button, as follows: Lines...
Read more >how to disable button(onclick javascript) after clicking that once?
If the button is placed on Standard Record Detail page then this button will always be available and cannot be disabled.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The target is the
button
element:The same but without the
span
works as expected and does not dispatch the event on thebutton
:not sure if this is related.
In react when we set button props
disabled
, the onClick event will not fire. When the user enables the button fromdevtool/inspect-element
by removing the disabled attribute fromhtml
. the onClick still will not fire. I have tried this and that’s work and this is my expected behavior. because I want to prevent users from clicking by role access to the button.I’m just still not certain that this is correct.