Skip to content

DYN-10640: Port context menu flashes for a split second then disappears#17183

Merged
jasonstratton merged 3 commits into
DynamoDS:masterfrom
ivaylo-matov:DYN-10640-Port-context-menu-flashes-for-a-split-second-then-disappears
Jun 23, 2026
Merged

DYN-10640: Port context menu flashes for a split second then disappears#17183
jasonstratton merged 3 commits into
DynamoDS:masterfrom
ivaylo-matov:DYN-10640-Port-context-menu-flashes-for-a-split-second-then-disappears

Conversation

@ivaylo-matov

@ivaylo-matov ivaylo-matov commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Purpose

This PR fixes DYN-10639, a regression introduced in #16763 where the port context menu briefly flashes and then disappears when opened with a left mouse click.

This PR makes WorkspaceView subscribe to its owner window's Deactivated event and close the port context menu when Dynamo loses focus:

  • WorkspaceView_Loaded / WorkspaceView_Unloaded - resolve the owner window via Window.GetWindow(this) and subscribe/unsubscribe the Deactivated handler. The cached ownerWindow field guarantees we unsubscribe from the exact same window in Unloaded/Dispose.
  • OwnerWindow_Deactivated - closes the port context menu via DestroyPortContextMenu() on window deactivation.
DYN-10640-Fix

Declarations

Check these if you believe they are true

Release Notes

Port context menu does not flash only for a split second when called with left mouse click and closed when the owner window loses focus.

Reviewers

@DynamoDS/eidos
@jasonstratton
@johnpierson

FYIs

@dnenov

working draft
comments updated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10640

@ivaylo-matov

Copy link
Copy Markdown
Contributor Author

I can see that Smoke Test and SelfServe are failing, but I can't see the details. Can I please get access or a list of the failing tests? Thanks 😊

Screenshot 2026-06-22 073256

@ivaylo-matov ivaylo-matov changed the title DYN-10640: Port context menu flashes for a split second then disappears DYN-10639: Port context menu flashes for a split second then disappears Jun 22, 2026
@github-actions github-actions Bot changed the title DYN-10639: Port context menu flashes for a split second then disappears 10640: DYN-10639: Port context menu flashes for a split second then disappears Jun 22, 2026
@ivaylo-matov ivaylo-matov changed the title 10640: DYN-10639: Port context menu flashes for a split second then disappears DYN-10640: Port context menu flashes for a split second then disappears Jun 22, 2026
Guard against the case where Dispose() is called before the Unloaded
event fires, which would leave the WorkspaceView rooted via the
Deactivated handler on the owner Window.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@jasonstratton

Copy link
Copy Markdown
Contributor

Added a small cleanup in Dispose() (commit 4667364): unsubscribe from ownerWindow.Deactivated and null the field there, so we're covered if Dispose() is ever called before the Unloaded event fires. Without it, the WorkspaceView could stay rooted via the handler on the owner Window. Verified the new test still passes locally.

@jasonstratton jasonstratton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needed a simple additional cleanup in WorkspaceView.dispose() method. I just added it myself.

Looks good. Approved and merging

RemoveViewModelsubscriptions(ViewModel);
DataContextChanged -= OnWorkspaceViewDataContextChanged;
Loaded -= WorkspaceView_Loaded;
Unloaded -= WorkspaceView_Unloaded;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing one bit of cleanup, unsubscribing to OwnerWindow_Deactivated.

Simple change. I'll add it and merge.

@jasonstratton jasonstratton merged commit 8c02603 into DynamoDS:master Jun 23, 2026
24 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

2 participants