-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Text editing on mobile #147
Comments
This problem also occurs on the browser on PC when input method(IME) is needed, it may be caused by the incompatibility of the IME. The virtual keyboard on the mobile device is also an IME window, too. The input candidate window on PC or virtual keyboard on mobile device will pop up only when the browser’s (or native app's) input control gets focus. As we know, from the perspective of the native app or browser, Egui's "text widgets" are nothing more than a set of triangles, not input controls, so there will be no input candidate window or virtual keyboard. Egui_glium can communicate with IME correctly (but not yet complete), because it's window handler, winit, can connect to the input method service of the system and exchange data with it. But as far as I know, there is no similar method on the browser. |
The only way (that I know of) to open an IME window in a browser is by interacting directly with an input element. Some projects like CanvasInput use a hidden input element on the DOM to work. |
@parasyte thanks for that reference! The relevant code seems to be https://github.com/goldfire/CanvasInput/blob/master/CanvasInput.js#L125 and onwards. The problem for egui_web is that we don't want to always have a hidden This sounds exactly like the kind of hacky web code that I'd rather not have to write. If we can find some other option that would be great, but otherwise I guess this is the way. Any volunteers? |
Can you give us some idea of your prioritization of this issue? If not for this issue, egui would be my hands down pick for a Rust GUI framework. Sadly, I do not currently have the Rust skills to tackle this issue myself. Thank you very much for all of the work you have already done here. I am already very impressed with this project and hope to actually be able to contribute back in addition to utilizing it in my own projects. |
Honestly, this is mostly DOM/JavaScript work. The Rust parts are hooking into the egui event system so that clicking on a text field can trigger interaction with a hidden input element on the DOM, and allowing egui to receive events from the DOM itself. If I read between the lines a bit, I believe @emilk is referring to this chunk of DOM and JavaScript work as the part he would rather have someone else work on. 😉 |
Makes sense. Thank you for the clarification. I would almost certainly be more hindrance than help with DOM/JavaScript since my last hands-on GUI work of significance was probably Visual Basic 5.0 era. |
I am on it, maybe some more filds must be added to epi::backend::AppOutput, like "cursorPosition: Option<Pos2>", indicating if egui's text field is focused, and the cursor position. Is it ok? @emilk |
Thanks for taking a stab at this @n2 ! Feel free to add what you need! The cursor position shouldn't needed to be added though as far as I can tell, since But I do understand egui needs to communicate whether or not the cursor is hovering over a text field. There is a hacky way |
Sorry, I did not express the two cursors clearly. In my post, I meant the text cursor in textfield(which is egui::widgets::text_edit::CursorPair), not mouse cursor (whos position is stored in AppRunner.input.latest_touch_pos), app should return position of CursotPair::primary. By having such position, egui backends can not only manipulate hidden input element, but also set IME candidate window to proper position. This is useful for both web and native. |
Fixed by #247 |
@emilk Should this be closed? Just stumbled upon your last comment while looking for something else. |
Ah, yes - thanks for the reminder @parasyte |
egui_web
fails to bring up the virtual keyboard when editing text.You would think a modern browser would have a function call for "show a virtual keyboard!" but of course nothing is ever that simple in web-tech.
Related issue: #8
The text was updated successfully, but these errors were encountered: