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

Clicks pass through to widgets behind context menu #8

Open
lightningorb opened this issue Oct 26, 2021 · 1 comment
Open

Clicks pass through to widgets behind context menu #8

lightningorb opened this issue Oct 26, 2021 · 1 comment

Comments

@lightningorb
Copy link

Describe the bug
When clicking on the context menu items, the items behind it get clicked too

Expected behavior
Press events should not affect widgets behind, e.g if the context menu is over a text input, then the text input should not get the focus

@krystofair
Copy link

krystofair commented Nov 13, 2022

I add below method to my major application menu - class inherited from AppMenu.

    def collide_point(self, x, y):
        for item in self.walk():
            try:
                submenu = item.get_submenu()
                if submenu.visible and submenu.self_or_submenu_collide_with_point(x, y):
                    return True
            except:
                pass
        return super().collide_point(x, y)

This helps me, when context menu is rolled up from AppMenu. Then clicks don't pass through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants