algolia / algolia/autocomplete
`id` setting should apply to the form element too
- Dominant language
- TypeScript
- Stars
- 5.3k
- Forks
- 341
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 5
Description
## Description
The default autocomplete form has no `id` attribute, so you are unable to use external buttons to submit the form (`Submit`).
## Reproduction
[**Preview →**](https://codesandbox.io/s/small-cache-j968vr?file=/app.tsx)
**Steps**
1. Enter search term
2. Press enter on keyboard, see alert popup that form was submitted.
3. Press escape key on wide screen or click "Cancel" button on narrow screen to hide autocomplete panel
4. Click "External submit" button to submit the form.
5. No alert pops up this time.
6. Manually add the `id="form-id"` attribute to the generated autocomplete form and click the "External submit" button and see the popup does show.
## Expected behavior
The `` element would receive the passed `id`. This is also useful when we are replacing an existing form with the autocomplete (JavaScript fallback), which already has an `id`. So if we can assign the `id` here, the same button can be used to submit whether it's the fallback form or the autocomplete form.
## Environment
- OS: Linux
- Browser: Firefox
- Autocomplete version: 1.9.2
Contributor guide
Research direction
Start with the linked CodeSandbox reproduction in app.tsx and trace how the autocomplete form is generated from the passed id setting. Verify the external submit button works after the panel is hidden, and confirm the generated form receives the same id as the fallback form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100