ampproject / ampproject/amphtml

Allow autocomplete to have a custom click handler on tap

Open
#30,182 2 comments 0 reactions 0 assignees View on GitHub
Component: amp-autocomplete P3: When Possible Stale Type: Feature Request WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## Describe the new feature or change to an existing feature you'd like to see

Hello,
I have a use case that I haven't found anything that mentions it in the docs. I want to be able to run a custom click handler for each auto-complete item. This will enable me to achieve this use case.

## Describe alternatives you've considered

I tried to use a single amp-script that does everything using javascript without any other amp components. It fell short and I had to redo everything using amp components, like auto complete, form, bind, etc.

## Additional context

The feature I'm trying to implement is an amp autocomplete that lets you search for areas, once you click an item, a custom handler should intercept that, does some transformations and saves generated url to local storage, after that the form is submitted to the backend where the user is redirected to that specific search area they clicked on.

When this user comes back in the future, they'll find a list of their previous searches below the amp autocomplete using an amp-list component.

Hope my use case is clear enough.

Contributor guide

Open the contributing guide

Research direction

Start by locating the AMP autocomplete component and reviewing its existing item-selection and tap behavior, along with the related amp-form, bind, and amp-list documentation mentioned in the issue. Done should mean each autocomplete item can invoke a custom handler on tap while supporting the described transformation and form-submission flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.