You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
UPDATE 1: This is a bug in winit. The Wayland IME implementation is incorrect. The Windows and macOS winit IME implementations work fine. The issue I filed was almost immediately closed and I was told it is working as expected. There is a fundamental disagreement about how IME is supposed to work.
UPDATE 2: The empty Ime::Preedit events have been fixed. I still get Ime::Enabled events though. It might be enough to fix this specific issue. I tried upgrading winit but there has unfortunately been several breaking changes so it will require some more work.
I can get the bug to go away if I comment out the compositionupdate handling code in handle_event in HTMLInputElement. That also fixes issue #39026.
I'm not using an input method editor (IME) but Servo gets composition events (from IME) despite that. Firefox does not get composition events unless you use an IME. I think a good start is to only create composition events if an IME is present.
UPDATE: The compositionupdate code was added in PR #35535
UPDATE 2: I simplified the composition (IME) example from MDN and put it on my GitHub website. When running in Servo the text input get IME messages that Firefox's text input doesn't get.
UPDATE 3: The problem also goes away if I comment out the code to enable IME self.winit_window.set_ime_allowed(true).
@dklassic Do you have any idea what is going on or any tips on how to proceed?
I tried to replicate it on macOS with ime enabled and disabled which both doesn't result in the issue you mentioned, or maybe I'm misunderstanding the procedure:
2025-09-05.10.06.14.mov
Accompanying your results I would assume this might be a winit bug on Linux which misfires an ime event resulting in the overwrite of the selected text.
Thanks @dklassic! The behavior in your video looks correct. Yeah, it sounds like it might be a winit bug on Linux.
I'm getting Preedit events with empty data as soon as I click into the text input. I'm not using an IME. Do you know if that is expected behavior? I would expect that I shouldn't get any Preedit events until I activate an IME?
Sorry, if some of these questions don't make sense. I don't have any experience implementing IME support.
I'm getting Preedit events with empty data as soon as I click into the text input. I'm not using an IME. Do you know if that is expected behavior? I would expect that I shouldn't get any Preedit events until I activate an IME?
I would assume the same, and honestly I would assume activating IME alone shouldn’t result in any event sent unless any actual keystroke was made.
Alternatively I think we could also choose to ignore IME event when the data is empty which might also make sense.
I'm getting Preedit events with empty data as soon as I click into the text input. I'm not using an IME. Do you know if that is expected behavior? I would expect that I shouldn't get any Preedit events until I activate an IME?
I would assume the same, and honestly I would assume activating IME alone shouldn’t result in any event sent unless any actual keystroke was made.
Thanks! I'm happy to hear that I'm not completely off track 😀 I'll reach out to the winit project.
Alternatively I think we could also choose to ignore IME event when the data is empty which might also make sense.
Ok, that sounds like a reasonable work around if it can't be fixed in winit.
@kchibisov, as far as I understand IME, you shouldn't receive a preedit event unless you have opened an input editor (for example with Super+.). This works on Windows and macOS (I think this is what @dkclassic saw too, please correct me if I'm wrong). On Wayland you get preedit events without opening an input editor.
@MichaelMcDonnell API doesn't say so though. But as I said on winit issue, your issue is because your IME is broken in the first place to send event which it shouldn't send, which my workaround kind of masks.
Activity
MichaelMcDonnell commentedon Sep 1, 2025
I can get the bug to go away if I comment out the
compositionupdatehandling code inhandle_eventinHTMLInputElement. That also fixes issue #39026.I'm not using an input method editor (IME) but Servo gets composition events (from IME) despite that. Firefox does not get composition events unless you use an IME. I think a good start is to only create composition events if an IME is present.
UPDATE: The
compositionupdatecode was added in PR #35535UPDATE 2: I simplified the composition (IME) example from MDN and put it on my GitHub website. When running in Servo the text input get IME messages that Firefox's text input doesn't get.
UPDATE 3: The problem also goes away if I comment out the code to enable IME
self.winit_window.set_ime_allowed(true).MichaelMcDonnell commentedon Sep 1, 2025
The IME events are coming from
winitand passed on to servoshell in headed_window.rs. Maybe this is a winit bug, or we are using it the wrong way?MichaelMcDonnell commentedon Sep 4, 2025
@dklassic Do you have any idea what is going on or any tips on how to proceed?
dklassic commentedon Sep 5, 2025
I tried to replicate it on macOS with ime enabled and disabled which both doesn't result in the issue you mentioned, or maybe I'm misunderstanding the procedure:
2025-09-05.10.06.14.mov
Accompanying your results I would assume this might be a winit bug on Linux which misfires an ime event resulting in the overwrite of the selected text.
MichaelMcDonnell commentedon Sep 5, 2025
Thanks @dklassic! The behavior in your video looks correct. Yeah, it sounds like it might be a
winitbug on Linux.I'm getting Preedit events with empty data as soon as I click into the text input. I'm not using an IME. Do you know if that is expected behavior? I would expect that I shouldn't get any Preedit events until I activate an IME?
Sorry, if some of these questions don't make sense. I don't have any experience implementing IME support.
dklassic commentedon Sep 5, 2025
I would assume the same, and honestly I would assume activating IME alone shouldn’t result in any event sent unless any actual keystroke was made.
Alternatively I think we could also choose to ignore IME event when the data is empty which might also make sense.
MichaelMcDonnell commentedon Sep 5, 2025
Thanks! I'm happy to hear that I'm not completely off track 😀 I'll reach out to the
winitproject.Ok, that sounds like a reasonable work around if it can't be fixed in
winit.kchibisov commentedon Sep 11, 2025
empty preedit tells that it got cleared https://docs.rs/winit/latest/winit/event/enum.Ime.html#variant.Preedit . if you had it empty already, nothing should be done really.
Well, winit can in theory try to emit less events, but docs clearly say that it clears preedit not text in your editor.
MichaelMcDonnell commentedon Sep 12, 2025
@kchibisov, as far as I understand IME, you shouldn't receive a preedit event unless you have opened an input editor (for example with Super+.). This works on Windows and macOS (I think this is what @dkclassic saw too, please correct me if I'm wrong). On Wayland you get preedit events without opening an input editor.
kchibisov commentedon Sep 12, 2025
@MichaelMcDonnell API doesn't say so though. But as I said on winit issue, your issue is because your IME is broken in the first place to send event which it shouldn't send, which my workaround kind of masks.
mrobinson commentedon Jan 19, 2026
@MichaelMcDonnell Can you try this again now that #41979 has landed?
MichaelMcDonnell commentedon Jan 22, 2026
Thanks @mrobinson! I can confirm that is has been fixed 😀