I have some atypical use cases for autocomplete that I’d like full control of open/closed state for. Primarily, I’d like to supply suggestions when a user moves the cursor into certain fields.
Unfortunately the implicit close behavior on change when the user event is null
prevents this. Instead, the sources get marked inactive.
Is there a way around this currently?
@codemirror/autocomplete
implements classical autocomplete. If you want a different approach, I’d recommend building it from scratch rather than trying to make that package do something it wasn’t designed for.
I do quite enjoy the classical autocomplete features it supplies as well
Would you take a PR that made the auto-close functionality optional or pluggable? I’ve patched it out using pnpm
and in testing and it appears to be working well…
You can run startCompletion
whenever you want. Doesn’t that already make it possible to open completion when the user moves into a field?
I need to test this and get back(I may have already but not with 100% confidence). My worry is that it’ll “blink” as it’s closed and then reopened during arrow key presses moving the cursor within the same field.
After patching in exporting the start effect and using that I ended up with a render loop… But will do more to confirm.
Also, happy to submit a PR implementing any design you may have in mind exposing more explicit control.