Add search bar autosuggestions with keyboard navigation and mobile support#77
Open
Copilot wants to merge 3 commits into
Open
Add search bar autosuggestions with keyboard navigation and mobile support#77Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Co-authored-by: niraj-sachania <39126181+niraj-sachania@users.noreply.github.com>
Co-authored-by: niraj-sachania <39126181+niraj-sachania@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add search bar autosuggestions for city names
Add search bar autosuggestions with keyboard navigation and mobile support
Nov 21, 2025
|
|
||
| try { | ||
| const response = await fetch( | ||
| `https://strong-mermaid-23f3ab.netlify.app/.netlify/functions/getCoordinates?cityOrPostcode=${encodeURIComponent( |
Owner
There was a problem hiding this comment.
This end point gets coordinates for the city name or postcode. Find an endpoint that gets a list of cities to autosuggest from
Owner
niraj-sachania
left a comment
There was a problem hiding this comment.
`https://strong-mermaid-23f3ab.netlify.app/.netlify/functions/getCoordinates?cityOrPostcode=${encodeURIComponent(
This end point gets coordinates for the city name or postcode. Find an endpoint that gets a list of cities to autosuggest from
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements live city name suggestions as users type in the search box, with debounced API calls, keyboard navigation, and touch-optimized mobile interactions.
Changes
New module:
assets/js/autocomplete-api.jsEnhanced:
assets/js/location-search.js↑/↓to navigate,Enterto select,Escto closetouchend(prevents scroll interference)Styling:
assets/css/style.cssModule system:
index.htmltype="module"for ES6 importsImplementation
Dropdown appears below search input with ARIA attributes (
role="listbox",aria-selected) for accessibility. Suggestions render using existing.search-resultsstyling for visual consistency.Screenshot
Dropdown will appear with city suggestions when typing (external API blocked in test environment but works in production)
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.