From 9d9e542d2180369feaef5110017eea9128720406 Mon Sep 17 00:00:00 2001 From: "valentin.tsvetkov@testomat.io" Date: Fri, 9 Oct 2026 14:16:19 +0400 Subject: [PATCH] Let host disable step suggestions while typing A `data-step-autocomplete="false"` attribute on any ancestor of the editor stops the step dropdown from popping up as you type. The "Show suggestions" button and Ctrl/Cmd+Space still open the list, which keeps filtering while typing until blur or selection. Exposed as `isStepAutocompleteOnTypeEnabled` and `STEP_AUTOCOMPLETE_ATTRIBUTE`; the playground gets a toggle. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 ++ src/App.tsx | 13 +++++++++++- src/editor/blocks/stepField.tsx | 14 ++++++++++-- src/editor/stepAutocomplete.test.ts | 33 ++++++++++++++++++++++++++++- src/editor/stepAutocomplete.tsx | 9 ++++++++ src/index.ts | 2 ++ 6 files changed, 69 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3689ec7..fc29569 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,8 @@ Step suggestions accept either an array of `{ id, title, ... }` or the JSON:API When a user types in Step Title, autocomplete filters these titles; Tab/Enter/Ctrl/Cmd+Space or the ⌄ button will insert the selection. +To stop suggestions from popping up while typing, set `data-step-autocomplete="false"` on any ancestor of the editor (for example the element the editor is mounted into). The "Show suggestions" button and Ctrl/Cmd+Space still open the list. The attribute is read on every edit, so toggling it takes effect immediately; `isStepAutocompleteOnTypeEnabled(element)` exposes the same check. + ## Running Tests Vitest covers the Markdown/block converter. Run the suite with: diff --git a/src/App.tsx b/src/App.tsx index bbf1200..89308f2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -523,6 +523,7 @@ function App() { "idle", ); const [darkMode, setDarkMode] = useState(false); + const [suggestWhileTyping, setSuggestWhileTyping] = useState(true); const [markdownInput, setMarkdownInput] = useState(""); const [inputError, setInputError] = useState(null); @@ -771,6 +772,13 @@ function App() { > Insert Test +