Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX Tab change input field focus breaks rendering #2367

Open
Amatrelan opened this issue Mar 9, 2023 · 4 comments · May be fixed by #2381
Open

OSX Tab change input field focus breaks rendering #2367

Amatrelan opened this issue Mar 9, 2023 · 4 comments · May be fixed by #2381
Labels
bug does not behave the way it is supposed to shell/mac concerns the macOS backend

Comments

@Amatrelan
Copy link

Amatrelan commented Mar 9, 2023

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

  • Macbook Pro 2019
  • macOS: Ventura 13.2.1

Steps to Reproduce

  • git clone https://github.com/linebender/druid
  • cd druid/druid
  • cargo run --example flex
  • Go to either input field (I went to hello)
  • Press tab

Screenshot 2023-03-09 at 11 57 29

@matthewgapp
Copy link
Contributor

matthewgapp commented Jun 3, 2023

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()),
        },
    );
}

@xStrom
Copy link
Member

xStrom commented Jun 7, 2023

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 xStrom added bug does not behave the way it is supposed to shell/mac concerns the macOS backend labels Jun 7, 2023
@matthewgapp
Copy link
Contributor

@xStrom would you mind reviewing my PR that fixes this issue? #2381

@xStrom
Copy link
Member

xStrom commented Jun 8, 2023

Yes I will try to do that soon. Confirming the bug was the first step in that process. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug does not behave the way it is supposed to shell/mac concerns the macOS backend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants