input: Clean focused_input on Input blur. (#825)

This commit is contained in:
Jason Lee 2025-04-30 14:08:39 +08:00 committed by GitHub
parent 69dad78867
commit 6dea2cb57c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -514,7 +514,6 @@ impl Element for TextElement {
}
// And reset focused_input when next_frame start
window.on_next_frame({
let input_view = self.input.clone();
move |window, cx| {

View file

@ -34,7 +34,7 @@ use crate::indicator::Indicator;
use crate::input::clear_button;
use crate::scroll::{Scrollbar, ScrollbarAxis, ScrollbarState};
use crate::{h_flex, StyledExt};
use crate::ActiveTheme;
use crate::{ActiveTheme, Root};
use crate::{IconName, Size};
use crate::{Sizable, StyleSized};
@ -1490,6 +1490,9 @@ impl TextInput {
self.blink_cursor.update(cx, |cursor, cx| {
cursor.stop(cx);
});
Root::update(window, cx, |root, _, _| {
root.focused_input = None;
});
cx.emit(InputEvent::Blur);
}