Groww Financial Instrument Autocomplete Search
Groww is a leading investment platform, and a seamless user experience is paramount. A crucial part of this experience is the ability for users to quickly find the financial instruments (stocks, mutual funds, etc.) they are looking for. This problem challenges you to build a performant and user-friendly autocomplete search component, mimicking the real-world functionality critical for efficient navigation and discovery on platforms like Groww.
Your goal is to implement a client-side autocomplete search component for financial instruments based on provided mock data. You must satisfy the following deliverables:
MOCK_DATA to find matching financial instruments. The search should be case-insensitive and match against both the name and symbol fields of each instrument.name or symbol that matches the user's search query.ArrowUp/ArrowDown: Navigate through the search results.Enter: Select the currently active (highlighted) result.Escape: Close the dropdown.Enter key), display the selected instrument's details prominently below the autocomplete component. The search input should be cleared, and the dropdown should close.name and symbol.name or symbol (case-insensitive substring match).ArrowUp and ArrowDown keys correctly navigate through dropdown items.Enter on an active dropdown item selects it, clears the input, and displays the selected item's details.Escape key press or when clicking outside the component (without selecting an item).Constraints
MOCK_DATA) is provided upfront in the client-side code. No external API calls are required for searching.aria-* attributes are a plus but not strictly required for the time budget).Loading editor...