-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Fix SimpleDropdown close event #7627
Conversation
fb83879
to
15dd834
Compare
I'm not sure I follow - how would that result in Edit: Oh wait, it looks like Edit2: Yes, that is indeed the case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Though I think this would be slightly improved if we didn't rely upon propagation. Following the logic of how events are handled as they propagate can be confusing.
15dd834
to
23ad1a2
Compare
Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
* origin/develop: Fix SimpleDropdown event bubbling (#7627) Remove unneeded store connections (#7625) Replace wild random number key with index (#7629) Use ES6 exports for selectors (#7626) Fix a typo made comparing previous prop (#7628) Connect distinct accounts per site (#7004) eslint: Enable more react/jsx-* rules (#7592) Enable react/no-unused-state rule for ESLint (#7609) Enable no-var rule for ESLint (#7590) Process URL fragment for ens-ipfs redirects (#7604) add locale fix script (#7580) Prevent redux state mutation (#7598)
Refs #7540
This PR fixes a bug that has surfaced post-#7540, where the dropdown wouldn't close after a selection.
The call to
this.handleClose()
in the onClick handler would set the state to false which would result intoggleOpen
, called in theonClick
handler on the parentdiv
, readingfalse
fromprevState
. This wasn't an issue before as the reference to state was stale/read before the setState call.The fix here stops the propagation of the click event to the parent.