You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the library supports searching for countries within the dropdown; however, the search functionality does not allow users to filter countries in a couple key ways:
Filtering as you type - matching countries whose names start with the entered search term (e.g., typing "U" should immediately filter to "United States," "United Kingdom," etc.). This could perhaps be achieved by adding an additional option to configure the search behavior (e.g., searchMode: "startswith" | "includes").
Country abbreviations - matching countries by their abbreviations or common short forms (e.g., typing "US" for "United States" or "UK" for "United Kingdom"). Perhaps you could use ISO 3166-1 alpha-2/alpha-3 codes in the search index.
What are your thoughts on enhancing the country search functionality in the aforementioned ways?
Thank you for your work on this project! It truly is appreciated. 🌟
The text was updated successfully, but these errors were encountered:
Hi there, thanks for the suggestions. So to clarify, we do currently filter on what is typed, but we don't do any re-ordering - it's just any countries that contain that string will appear in the list, in chronological order. Based on your suggestions, I think it would be a nice improvement to add some simple weighting, so if a country starts with the query string, then it should be weighted higher than a country that includes the string in another position. Likewise, we could prioritise abbreviations (probably only after 2 characters have been typed), probably weighting them even higher than countries starting with the query string.
So the weighting hierarchy would be:
Abbreviation matches (when 2+ chars typed)
Starts with
Includes
What do you think?
At some point, we may think of more weighting levels we want to implement (e.g. maybe country population?), but I think this would be a good start.
I don't have time to implement this myself right now, but would welcome a pull request.
Thanks for your response, @jackocnr! I apologize for my mistake with how things are currently filtered. 🙈
I do like the idea of focusing on abbreviations first, then using starts with, and then includes. This would meet our needs and improve the user experience. Additional weighting levels like country population would be an interesting feature to play around with at some point, but it might not be worth the additional js bloat it would create. It'd be something worth investigating at some point down the road, though!
I have someone from my team looking into implementing your weighting hierarchy suggestion; we'll hopefully be able to get a PR out to you soon!
Currently, the library supports searching for countries within the dropdown; however, the search functionality does not allow users to filter countries in a couple key ways:
What are your thoughts on enhancing the country search functionality in the aforementioned ways?
Thank you for your work on this project! It truly is appreciated. 🌟
The text was updated successfully, but these errors were encountered: