Skip to content

Commit

Permalink
Fix wasm deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Nov 30, 2024
1 parent 5c74c66 commit 4e4b878
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/text_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ pub fn install_text_agent(
.expect("failed input type coercion");
let input = std::rc::Rc::new(input);
input.set_type("text");
input.set_autofocus(true);
if let Err(err) = (&input as &web_sys::HtmlElement).set_autofocus(true) {
log::warn!("Failed to set input autofocus: {err:?}");
}
input
.set_attribute("autocapitalize", "off")
.expect("failed to turn off autocapitalize");
Expand Down Expand Up @@ -134,7 +136,9 @@ pub fn install_text_agent(
}
// Set size as small as possible, in case user may click on it.
input.set_size(1);
input.set_autofocus(true);
if let Err(err) = (&input as &web_sys::HtmlElement).set_autofocus(true) {
log::warn!("Failed to set input autofocus: {err:?}");
}
input.set_hidden(true);

let sender = text_agent_channel.sender.clone();
Expand Down

0 comments on commit 4e4b878

Please sign in to comment.