Commit 44fa02d
authored
fix(web): prevent invisible IME agent from intercepting mouse clicks near cursor
#### Problem
In WASM/Web environments, `egui` provides `IMEOutput` to the browser to handle IME composition and mobile text input. The browser creates an invisible text agent (like a hidden `<textarea>`) based on the provided `cursor_rect`.
However, this hidden element often possesses a small physical hitbox (especially to the right of the cursor). This causes a bug where mouse clicks occurring slightly to the right of the text cursor are intercepted by the browser's hidden element and never reach the `egui` canvas, resulting in "dead zones" for user interaction.
#### Solution
This PR modifies the `cursor_rect` passed to `IMEOutput` to be a zero-width `Rect` (`tiny_rect`).
- By setting the size to `Vec2::ZERO`, the browser's invisible agent no longer has a clickable area, ensuring all pointer events are correctly delivered to the `egui` canvas.
- The `left_top` position is preserved, so IME candidate windows (like Hanja or Emoji pickers) still appear at the correct coordinate relative to the cursor.
#### Impact
- **Fixed:** Clicking near/on the text cursor in `TextEdit` (WASM) is now 100% reliable.
- **No Regression:** IME functionality remains intact as the positional anchor is unchanged.1 parent 64a96ef commit 44fa02d
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
800 | 802 | | |
801 | 803 | | |
802 | | - | |
| 804 | + | |
803 | 805 | | |
804 | 806 | | |
805 | 807 | | |
| |||
0 commit comments