-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handleClickOutside not called when clicking on a disabled button #352
Comments
The only element I can reproduce this for is the disabled text input, and then only in Firefox - Chrome seems to work correctly on every disabled element for me in Windows. Which OS/browser combination(s) did you find this in? |
Oh interesting! Thanks for taking the time to try and recreate this.
I discovered this on Chrome on macOS.
…On Thu, 22 Apr 2021 at 5:52 pm, Pomax ***@***.***> wrote:
The only element I can reproduce this for is the disabled text input, and
then only in Firefox - Chrome seems to work correctly on every disabled
element for me in Windows. Which OS/browser combination(s) did you find
this in?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#352 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAA4YKDYF2SEUHNVVE44ADTKBH3JANCNFSM43MEJWMA>
.
|
Urgh, I just spotted that the Code Sandbox link I sent before wasn't correctly set up (it still contained a work around I was trying for the bug). I've removed the workaround and it should now be demonstrating the problem with clicking on disabled buttons. |
Yep, that's doing what you described. Reduced test case: import React, { Component } from "react";
import { render } from "react-dom";
import onClickOutside from "react-onclickoutside";
class Clicker extends Component {
state = { numClicks: 0 }
render = () =>
<div style={{background:`lightgrey`}}>
Num clicks {this.state.numClicks}
</div>
handleClickOutside() {
this.setState({
numClicks: this.state.numClicks + 1
});
};
}
const WrappedClicker = onClickOutside(Clicker);
render([
<WrappedClicker />,
<input disabled value="test"/>
], document.getElementsByTagName(`div`)[0]); with HTML: <!DOCTYPE html>
<html>
<head><title>React App</title></head>
<body><div></div></body>
</html> |
I think I've come across a bug in this library where clicking on a disabled button does not trigger
handleClickOutside
.See this CodeSandbox for a minimal recreation of the bug:
https://codesandbox.io/s/react-onclickoutside-does-not-work-with-disabled-buttons-mio5q
Let me know if you need any more info!
The text was updated successfully, but these errors were encountered: