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:
@@ -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));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user