-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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 triggered by descendant Select #13216
Comments
@pleopardi Here is an example: <ClickAwayListener onClickAway={this.handleClickAway}>
<Select
value={this.state.selected}
onChange={this.handleChange}
MenuProps={{ disablePortal: true }}
>
<MenuItem value="first">First Option</MenuItem>
<MenuItem value="second">Second Option</MenuItem>
</Select>
</ClickAwayListener> |
This only works with first child https://codesandbox.io/s/jzj7np639v
|
@Teivaz Check the warning in the console: We are aware of this limitation, it's documented. Now, going forward, we are waiting on reactjs/rfcs#97 to land so we can accept a node over an element: /**
- * The wrapped element.
+ * The wrapped node.
*/
- children: PropTypes.element.isRequired,
+ children: PropTypes.node.isRequired, |
@octavioamu Thanks for clarification. I didn't see any warnings in my code and thought there was a bug in it. But after some investigation got it clear. |
Add |
Duplicate of #18586 |
I'm opening this issue because I saw the discussion here but the pull request closing the issue doesn't seem to apply to my case.
I have a
Select
component which is a descendant of aClickAwayListener
component. Clicking on one of theMenuItem
s triggers the callback ofClickAwayListener
.I saw the pull request adding
disablePortal
option but I couldn't find a way to apply it to Select (I saw it only inPopper
andModal
components).Expected Behavior
ClickAwayListener callback shouldn't be triggered clicking on a descendant component.
Current Behavior
But it does and I can't find a way to apply the
disablePortal
fix toSelect
component. I'd like to avoid using native select to solve the issue.Steps to Reproduce
Link:
Context
I have a
Collapse
containing several filters which closes every time I select an item from theSelect
filter.Your Environment
Project generated with create-react-app, not ejected.
The text was updated successfully, but these errors were encountered: