diff --git a/egui_web/src/lib.rs b/egui_web/src/lib.rs index 293267b599c1..bc4033c62ca7 100644 --- a/egui_web/src/lib.rs +++ b/egui_web/src/lib.rs @@ -1225,8 +1225,12 @@ fn move_text_cursor(cursor: &Option, canvas_id: &str) -> Option<()> if is_mobile() == Some(false) { cursor.as_ref().and_then(|&egui::Pos2 { x, y }| { let canvas = canvas_element(canvas_id)?; - let y = y + (canvas.scroll_top() + canvas.offset_top()) as f32; - let x = x + (canvas.scroll_left() + canvas.offset_left()) as f32; + // If you enable the lines after + // After entering a new line so that the height of TextEdit exceeds the height of the browser window, + // if you enter any text, the egui screen will be driven outside the client area. + // let y = y + (canvas.scroll_top() + canvas.offset_top()) as f32; + // let x = x + (canvas.scroll_left() + canvas.offset_left()) as f32; + // Canvas is translated 50% horizontally in html. let x = x - canvas.offset_width() as f32 / 2.0; style.set_property("position", "absolute").ok()?;