fizzy icon indicating copy to clipboard operation
fizzy copied to clipboard

Enter # or ## or ### then space and you are locked and can't type

Open silva96 opened this issue 3 weeks ago • 1 comments

Not sure if this is a bug in fizzy or lexxy, but I noticed that trying to use markdown titles blocks you from typing and can't escape from that state

https://github.com/user-attachments/assets/dee1c867-f24a-4062-a0a5-2cd46117d0ce

silva96 avatar Dec 02 '25 18:12 silva96

Super-hack: /cc @jorgemanrubia @GabManette

diff --git a/src/elements/prompt.js b/src/elements/prompt.js
index 0412fb2..ee38cab 100644
--- a/src/elements/prompt.js
+++ b/src/elements/prompt.js
@@ -339,6 +339,15 @@ export default class LexicalPromptElement extends HTMLElement {
   }
 
   #handleSelectedOption(event) {
+    // If the key is SPACE, we only want to select the option if the user has typed something.
+    // Otherwise, we want to let the editor handle the space key (e.g. for Markdown headers).
+    const isSpace = event instanceof KeyboardEvent && event.key === " "
+    const isQueryEmpty = this.#editorContents.textBackUntil(this.trigger) === ""
+
+    if (isSpace && isQueryEmpty) {
+      return false
+    }
+
     event.preventDefault()
     event.stopPropagation()
     this.#optionWasSelected()

jeremy avatar Dec 03 '25 05:12 jeremy