Skip to content

Context Menu Shadow and Placement Issues #1860

@biowaffeln

Description

@biowaffeln

Description

I was using the menu component to create a context menu that provides some actions inside my chess ui:

    div()
        .context_menu(move |menu, _window, _cx| {
            let mut menu = menu.item(PopupMenuItem::new("Delete Move").on_click({
                let model = model.clone();
                move |_ev, _window, cx| {
                    model.update(cx, |game, cx| {
                        game.delete_move(node_id);
                        cx.notify();
                    });
                }
            }));

            if variation_depth >= 1 {
                menu = menu
                    .separator()
                    .item(PopupMenuItem::new("Promote Variation").on_click({
                        let model = model.clone();
                        move |_ev, _window, cx| {
                            model.update(cx, |game, cx| {
                                game.promote_variation(node_id);
                                cx.notify();
                            });
                        }
                    }));
            }

            if variation_depth >= 2 {
                menu = menu.item(PopupMenuItem::new("Promote to Main Line").on_click({
                    let model = model.clone();
                    move |_ev, _window, cx| {
                        model.update(cx, |game, cx| {
                            game.promote_to_main_line(node_id);
                            cx.notify();
                        });
                    }
                }));
            }

            menu
        })
        .child(display_text)

While doing this, I bumped into two issues that I am not sure how to resolve.

  1. Behind the context menu there appears a blob-like shadow which I would like to remove. See this picture.
Image
  1. When resizing the window, the context menu does not move and stays at the previous position. See this picture.
Image

Steps to Reproduce

you can check out the version of my project that uses the context menu here:
https://github.com/biowaffeln/gpui-chess/tree/context-menu-bug

Environment

  • Platform: MacOS
  • gpui: 0.2.2
  • gpui-component: 0.5.0

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