Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Speech-to-text (dictation) on iOS deletes words after completion #6940

Open
moughxyz opened this issue Dec 11, 2024 · 1 comment
Open
Labels
composition Relating to IME inputs

Comments

@moughxyz
Copy link
Contributor

Please see video.

Steps to replicate:

  1. On iOS, open https://playground.lexical.dev/
  2. Delete all the filler text
  3. Hit the system microphone button on the keyboard (not lexical's microphone button)
  4. Begin dictating, adding 2 sentences or so.
  5. After you're done, hit the microphone button again to stop dictation.

At this point, you'll see a good amount of words disappear from the editor.

speech-bug-2.mov

As a first step I'm just opening this ticket to increase exposure in case someone might obviously know what's wrong, before investigating deeper.

Via chatgpt, speech to text uses composition events compared to traditional keyboard input:

•	Dictation uses composition events to handle intermediate input. These include:
•	   compositionstart: Marks the beginning of dictated input.
•	   compositionupdate: Fires as the text updates.
•	   compositionend: Finalizes the text input.
•	Keyboard input usually doesn’t rely on compositionupdate.

https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalEvents.ts#L899

@etrepum etrepum added the composition Relating to IME inputs label Dec 11, 2024
@moughxyz
Copy link
Contributor Author

moughxyz commented Dec 12, 2024

This seems to also affect input with diacritic letters, which also uses composition. Characters are being deleted. Report from a user:

it's most likely because these are often typed with dead keys (i.e. two keystrokes). If typed with a single keystroke, they remain, if typed with a dead ˇ , they disappear. Tried a few random ones and can reproduce consistently
funny thing is that in fact the character does not appear alone, instead, the sequence appears (and vanishes) as two characters, like ˇČ

Explanation via chatgpt again (sorry):

Why Composition Events Are Used

When typing diacritic letters:
	1.	The user usually starts with a “dead key” (e.g., ´, ^) or a specific key combination (e.g., Alt+e).
	2.	The browser enters a “composition mode” to wait for the next key input.
	3.	Once the user types the base letter (e.g., e), the browser combines the diacritic with the base letter and exits composition mode.

This process involves multiple stages, which the browser tracks using composition events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
composition Relating to IME inputs
Projects
None yet
Development

No branches or pull requests

2 participants