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

Filter pointer pressed events from disabled sub-menu items #6818

Merged

Conversation

simonhaines
Copy link
Contributor

What does the pull request do?

Clicking a disabled menu item in a top-level sub-menu unexpectedly closes the sub-menu. This pull request contains code that identifies this scenario and filters it out.

What is the current behavior?

PointerPressed events on disabled and non-interactive items in sub-menus are not handled until they are bubbled up to the sub-menu's parent. If the parent is a top-level menu item, the sub-menu is unexpectedly closed.

What is the updated/expected behavior with this PR?

The code in this pull request identifies PointerPressed events that bubble up from sub-menus by looking for a popup in the logical tree between the event source and its handler. In this case, the sub-menu remains open as expected.

Checklist

Fixed issues

Fixes #6412

Pointer clicks on disabled and non-interactive items in sub-menus
are bubbled up to the sub-menu's parent, causing the sub-menu popup
to be closed when it is expected to remain open. This scenario is
identified and filtered out by searching for a popup in the logical
tree between the source and the handler. Fixes AvaloniaUI#6412.
@dnfadmin
Copy link

dnfadmin commented Oct 29, 2021

CLA assistant check
All CLA requirements met.

Copy link
Member

@grokys grokys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent PR, thanks @simonhaines !

@Takoooooo Takoooooo enabled auto-merge November 4, 2021 11:31
@Takoooooo Takoooooo added the bug label Nov 4, 2021
@Takoooooo Takoooooo merged commit 49efa51 into AvaloniaUI:master Nov 5, 2021
danwalmsley pushed a commit that referenced this pull request Nov 23, 2021
Filter pointer pressed events from disabled sub-menu items
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled menu items shouldn't close the dropdown when clicked
5 participants