mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Fix virtual keyboard on (mobile) web (#4855)
Hello, I have made several corrections to stabilize the virtual keyboard on Android and IOS (Chrome and Safari). I don't know if these corrections can have a negative impact in certain situations, but at the moment they don't cause me any problems. I'll be happy to answer any questions you may have about these fixes. These fixes correct several issues with the display of the virtual keyboard, particularly since update 0.28, which can be reproduced on the egui demo site. We hope to be able to help you. Thanks a lot for your work, I'm having a lot of fun with egui :)
This commit is contained in:
@@ -252,16 +252,3 @@ pub fn percent_decode(s: &str) -> String {
|
||||
.decode_utf8_lossy()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
/// Returns `true` if the app is likely running on a mobile device.
|
||||
pub(crate) fn is_mobile() -> bool {
|
||||
fn try_is_mobile() -> Option<bool> {
|
||||
const MOBILE_DEVICE: [&str; 6] =
|
||||
["Android", "iPhone", "iPad", "iPod", "webOS", "BlackBerry"];
|
||||
|
||||
let user_agent = web_sys::window()?.navigator().user_agent().ok()?;
|
||||
let is_mobile = MOBILE_DEVICE.iter().any(|&name| user_agent.contains(name));
|
||||
Some(is_mobile)
|
||||
}
|
||||
try_is_mobile().unwrap_or(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user