-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(Dropdown): do not close on click when search is empty #1490
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1490 +/- ##
==========================================
+ Coverage 99.74% 99.74% +<.01%
==========================================
Files 141 141
Lines 2371 2378 +7
==========================================
+ Hits 2365 2372 +7
Misses 6 6
Continue to review full report at Codecov.
|
src/modules/Dropdown/Dropdown.js
Outdated
return this.close(e) | ||
} | ||
} | ||
return this.open(e) |
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.
Can we simplify logic there?
toggle = (e) => {
if (this.state.open) {
this.open(e)
return
}
const { search } = this.props
const options = this.getMenuOptions()
if (search && _.isEmpty(options)) {
e.preventDefault()
return
}
this.close(e)
}
It looks more readable to me.
Incorporating change request. Fixes Semantic-Org#1451
Released in |
Fixes #1451 . Mimics the behaviour of SUI core in similar scenario.