lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Markdown shortcuts don't fire on Firefox while a Korean IME is active

Open mayrang opened this issue 5 months ago • 0 comments

Lexical version: latest on playground.lexical.dev (also reproducible against current main)

Steps To Reproduce

  1. Open https://playground.lexical.dev/ in Firefox (verified on macOS).
  2. Switch the system input source to a Korean IME.
  3. Type - (dash, then space) at the start of an empty paragraph.

Link to code example:

https://github.com/user-attachments/assets/aa3976ee-17a8-4746-99cb-2d711655f542

The current behavior

Nothing happens — the text stays as literal - and no bullet list is created. The same is true for every markdown shortcut whose trigger is a single space (1. , # , > , ...). Switching the IME back to English makes them all fire normally.

A console capture of the event sequence confirms why. With the Korean IME active, Firefox routes the space key as keydown { key: 'Process' } followed by beforeinput { inputType: 'insertCompositionText', isComposing: true }, so the markdown shortcut listener never sees a plain insertText. The fallback path that should take over after the IME commits — tags.has(COMPOSITION_END_TAG) in MarkdownShortcuts.ts — is also missed: LexicalEvents.ts's onCompositionEnd only sets the isFirefoxEndingComposition flag on Firefox, and the deferred composition end inside onInput calls $onCompositionEndImpl but never calls $addUpdateTag(COMPOSITION_END_TAG).

The expected behavior

Markdown shortcuts should fire on Firefox the same way they fire on Chrome and Safari, even while a Korean IME is active. Typing - should convert to a bullet list, 1. to a numbered list, and so on.

Impact of fix

  • Affects Firefox users running a Korean IME.
  • The same gap silently affects other consumers of COMPOSITION_END_TAG on Firefox — lexical-history's composition-grouped merge and the playground autocomplete plugin's post-commit ghost both expect this tag.
  • The fix is one line in LexicalEvents.ts (PR coming up).

mayrang avatar Jun 11 '26 19:06 mayrang