algolia / algolia/autocomplete

Cannot programmatically open detached autocomplete if openOnFocus is false

Open
#843 12 comments 0 reactions 0 assignees View on GitHub
Scope: Detached mode Type: Bug
Dominant language
TypeScript
Stars
5.3k
Forks
341
Avg merge
3d 1h
Merged PRs (30d)
5

Description

## Description

The autocomplete does not open when calling `api.setIsOpen(true)` if `detachedMediaQuery` = `""` and `openOnFocus` = `false`.

## Reproduction

https://codesandbox.io/s/magical-tree-499cg?file=/app.tsx

**Steps**

1. Go to the codesandbox linked above
2. Click on the 'open autocomplete' button I added (around line 130 in `app.tsx`)
3. The autocomplete will flicker open for a split second, and then close.

## Expected behavior

The autocomplete should open when calling `api.setIsOpen(true);`.

## Environment

- OS: Windows
- Browser: Chrome
- Autocomplete version: 1.5.1

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox and inspect app.tsx around line 130, where the button calls api.setIsOpen(true). Reproduce the flicker with detachedMediaQuery="" and openOnFocus=false, then trace the autocomplete open-state behavior. Done means the autocomplete remains open after the programmatic call.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.