-
Notifications
You must be signed in to change notification settings - Fork 270
fix: Do not toggle dropwdown on pill removal #141
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
Conversation
src/tag/index.js
Outdated
<span className={cx('tag')}> | ||
{label} | ||
<button onClick={this.handleClick} className={cx('tag-remove')} type="button"> | ||
<button onClick={e => this.handleClick(e)} className={cx('tag-remove')} type="button"> |
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.
This can be simply onClick={this.handleClick}
(avoids creating a function on every render). I wonder why linting didn't flag this.
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.
Okay. I'll update it.
handleClick = e => { | ||
const { id, onDelete } = this.props | ||
|
||
e.stopPropagation() |
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.
Don't remember why but I think we also need to add e.stopImmediatePropagation()
too.
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.
Right. We can use stopImmediatePropagation()
because it implicitly calls stopPropagation()
. I'll update the code.
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.
LGTM!
fix: Do not toggle dropwdown on pill removal (dowjones#141) 🐛
fix: Do not toggle dropwdown on pill removal
Fixes #134
Prevents the dropdown from toggling again and again when the selected tags are removed.