-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[ClickAwayListener] Fix support for removed DOM node #20409
Conversation
Details of bundle changes.Comparing: 078fd1e...435b0f7 Details of page changes
|
Good news, we can actually solve the problem. I couldn't write an automated test for it, but could manually confirm it with: import React from 'react';
import ClickAwayListener from '@material-ui/core/ClickAwayListener';
const Demo = () => {
const [visible, setVisible] = React.useState(true);
return visible ? (
<button
type="button"
onClick={() => {
setVisible(false);
}}
>
Will be removed from DOM
</button>
) : null;
};
/**
* how you used the components
*/
export default function Demo2() {
const handleClickAway = () => {
console.log('fired')
};
return (
<div>
<Demo />
<ClickAwayListener onClickAway={handleClickAway}>
<div>Menu 1</div>
</ClickAwayListener>
</div>
);
} |
b49a9b7
to
435b0f7
Compare
@seare-kidane Thank you! |
@oliviertassinari Thank you for actually fixing this problem! |
@oliviertassinari Looks like the bug still exists. After updating |
Hi @seare-kidane , I follow what you did and updated the @material-ui/core to 4.9.9 in my project and check from the node_modules files that the changes in this PR isn't there, and then I checked the commit log, it seems that this PR isn't included in 4.9.9? |
I tried changing my package.json to this but my app is failing with `Module not found: Error: Can't resolve '@material-ui/core'. Currently, I also encounter these weird Clickaway closing on itself when clicking Select component inside, but I'm not sure how to apply this new PR fixes to my app :( |
Could you confirm that we are good at https://codesandbox.io/s/inspiring-newton-337c6? @pawlarius I'm curious, what was your process for figuring out how to use this patch? |
@oliviertassinari Confirming the fix on code sandbox works! |
@oliviertassinari Actually I am not sure how to use this patch, so I just try using commit id directly 😅. But I've just checked how you apply the patch on your sandbox 👍 @seare-kidane hope this will be included in the next release 🙇♀ |
It will be included in the next release, this weekend. |
doc.documentElement
check, for raisingonClickAway
eventCloses #20197