Open Amatrelan opened 1 year ago
This is reproducible by clicking between two input fields. The issue arises in 0.8.0. My issue is not reproducible in 0.7
See this video: https://github.com/linebender/druid/assets/61894094/a3edb4dc-c403-40e5-9414-d2658d6ee725
Repro code:
use std::sync::Arc;
use druid::{
widget::{prelude::*, Flex, SizedBox, TextBox},
AppLauncher, Color, Lens, LocalizedString, WidgetExt, WindowDesc,
};
fn launch<T: Data, W: Widget<T> + 'static>(make_ui: fn() -> W, data: T) {
let main_window = WindowDesc::new(make_ui())
.title(LocalizedString::new("learning the basics").with_placeholder("Hello world!"));
AppLauncher::with_window(main_window).launch(data).unwrap();
}
#[derive(Clone, Data, Lens)]
struct AppState {
name: Arc<String>,
dog_name: Arc<String>,
}
fn main() {
let ui = || {
Flex::column()
.with_child(
TextBox::new()
.with_placeholder("What is your name?")
.fix_width(200.0)
.lens(AppState::name),
)
.with_child(SizedBox::empty().height(300.))
.with_child(
TextBox::new()
.with_placeholder("What is your dog's name?")
.fix_width(200.0)
.lens(AppState::dog_name),
)
.background(Color::GREEN)
};
launch(
ui,
AppState {
name: Arc::new("".to_string()),
dog_name: Arc::new("".to_string()),
},
);
}
I managed to also reproduce it on my macOS Catalina 10.15, using the flex
example and either clicking with the mouse or tabbing.
Definitely a bug that should be resolved.
@xStrom would you mind reviewing my PR that fixes this issue? https://github.com/linebender/druid/pull/2381
Yes I will try to do that soon. Confirming the bug was the first step in that process. 👍
When using tab to change focus to next input element it breaks rendering in OSX. Normal clicking to elements don't break it.
Commit:
c02452ddeebc527992e8f112f434f23ce24c934d
System info
Steps to Reproduce
git clone https://github.com/linebender/druid
cd druid/druid
cargo run --example flex