diff --git a/src/components/views/elements/Dropdown.js b/src/components/views/elements/Dropdown.js index b4d2545e04..82f8d753a9 100644 --- a/src/components/views/elements/Dropdown.js +++ b/src/components/views/elements/Dropdown.js @@ -152,10 +152,12 @@ export default class Dropdown extends React.Component { } _onInputClick(ev) { - this.setState({ - expanded: !this.state.expanded, - }); - ev.preventDefault(); + if (!this.state.expanded) { + this.setState({ + expanded: true, + }); + ev.preventDefault(); + } } _onMenuOptionClick(dropdownKey) { @@ -252,7 +254,7 @@ export default class Dropdown extends React.Component { ); }); if (options.length === 0) { - return [
+ return [
No results
]; } diff --git a/src/components/views/login/CountryDropdown.js b/src/components/views/login/CountryDropdown.js index 8f342203bf..7024db339c 100644 --- a/src/components/views/login/CountryDropdown.js +++ b/src/components/views/login/CountryDropdown.js @@ -26,9 +26,14 @@ for (const c of COUNTRIES) { } function countryMatchesSearchQuery(query, country) { + // Remove '+' if present (when searching for a prefix) + if (query[0] === '+') { + query = query.slice(1); + } + if (country.name.toUpperCase().indexOf(query.toUpperCase()) == 0) return true; if (country.iso2 == query.toUpperCase()) return true; - if (country.prefix == query) return true; + if (country.prefix.indexOf(query) !== -1) return true; return false; } @@ -107,7 +112,7 @@ export default class CountryDropdown extends React.Component { const options = displayedCountries.map((country) => { return
{this._flagImgForIso2(country.iso2)} - {country.name} + {country.name} (+{country.prefix})
; });