Skip to content
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

breaking(Dropdown): clean searchQuery after selection in multiple search Dropdown #2112

Merged
merged 1 commit into from
Sep 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import { stateOptions } from '../common'
export default class DropdownExampleSearchQuery extends Component {
state = { searchQuery: '' }

handleChange = (e, { value }) => this.setState({
value,
searchQuery: '',
})
handleChange = (e, { searchQuery, value }) => this.setState({ searchQuery, value })

handleSearchChange = (e, { searchQuery }) => this.setState({ searchQuery })

Expand Down
4 changes: 2 additions & 2 deletions docs/app/Examples/modules/Dropdown/Usage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ const DropdownUsageExamples = () => (
examplePath='modules/Dropdown/Usage/DropdownExampleSearchQuery'
>
<Message info>
This example also shows how to override default bevahiour of the search query which keeps
entered value after selection.
This example also shows how to override default bevahiour of the search query and keep entered value after
selection.
</Message>
</ComponentExample>
<ComponentExample
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export default class Dropdown extends Component {

selectItemOnEnter = (e) => {
debug('selectItemOnEnter()', keyboardKey.getName(e))
const { multiple, onAddItem, search } = this.props
const { onAddItem, search } = this.props

if (keyboardKey.getCode(e) !== keyboardKey.Enter) return
e.preventDefault()
Expand All @@ -616,7 +616,7 @@ export default class Dropdown extends Component {
this.makeSelectedItemActive(e)
this.closeOnChange(e)

if (!multiple || isAdditionItem || optionSize === 1) this.clearSearchQuery()
if (isAdditionItem || optionSize === 1) this.clearSearchQuery()
if (search && this.searchRef) this.searchRef.focus()
}

Expand Down