Skip to content

[bug] First click on a MenuItem at the root of a Menu behaves the same as a Submenu #286

@sharky98

Description

@sharky98

I created the issue in Tauri tauri-apps/tauri#12649, but after a quick test, I think the behavior come from this library. I used the tao.rs example, simply adding a MenuItem at the root.

Doing so, the event is not trigerred when clicking on Fake Close, only on the second click (as if the first click opened the absent submenu and the second click triger the event)

    let file_m = Submenu::new("&File", true);
    let edit_m = Submenu::new("&Edit", true);
    let window_m = Submenu::new("&Window", true);
+    let close_m = MenuItem::new("Fake Close", true, None);

-     menu_bar.append_items(&[&file_m, &edit_m, &window_m]);
+     menu_bar.append_items(&[&file_m, &edit_m, &window_m, &close_m]);

    let custom_i_1 = MenuItem::with_id(
        "custom-i-1",
        "C&ustom 1",
        true,
        Some(Accelerator::new(Some(Modifiers::ALT), Code::KeyC)),
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions