autocomplete
autocomplete copied to clipboard
Inconsistent behavior on `Escape` and `Enter` in debug mode
Description
When debug=true
and you close the panel while still having pending requests, the resulting behavior is different depending on how you closed the panel:
- If you closed the panel with
Escape
, the panel stays closed - If you closed the panel with
Enter
, the panel reopens
This needs further investigations, but it's likely caused by different logic in the state reducer:
-
Escape
action doesn't acknowledgedebug
-
blur
action (triggered byEnter
) has a special branch fordebug
This behavior was initially observed in this followup.
Reproduction
Steps
- Throttle your browser (e.g., slow 3G)
- Type and quickly hit
Escape
(before network requests are settled), see how the panel remains closed - Type and quickly hit
Enter
(before network requests are settled), see how the panel reopens
Expected behavior
In both cases, the panel should stay closed even with debug
enabled because these are intentional closing behaviors.
This might be questionable, and we may need to further specify how we want debug
to behave (e.g., can you ever close the panel?)
Environment
- OS: macOs Big Sur 11.5.1
- Browser: Firefox 95.0.2
- Autocomplete version: 1.5.1