1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Fix focus problems on web (#4745)

* Closes https://github.com/emilk/egui/issues/4743
* Related to https://github.com/emilk/egui/issues/4569
This commit is contained in:
Emil Ernerfeldt
2024-07-01 10:38:54 +02:00
committed by GitHub
parent 31716d787e
commit d271718065
3 changed files with 43 additions and 18 deletions

View File

@@ -142,21 +142,25 @@ impl TextAgent {
super::has_focus(&self.input)
}
fn focus(&self) {
pub fn focus(&self) {
if self.has_focus() {
return;
}
// log::debug!("Focusing text agent");
if let Err(err) = self.input.focus() {
log::error!("failed to set focus: {}", super::string_from_js_value(&err));
};
}
fn blur(&self) {
pub fn blur(&self) {
if !self.has_focus() {
return;
}
// log::debug!("Blurring text agent");
if let Err(err) = self.input.blur() {
log::error!("failed to set focus: {}", super::string_from_js_value(&err));
};