Fails to invoke the context menu option for deleting a video when right clicking on any video on RS5
On right click of a video thumbnail, VLC brings up a flyout via FlyoutBaseGenerated::ShowAt. This calls CPopup::Open, which calls SetFocus to shift focus to the popup.
But the ListViewItem itself also has a right click handler in DirectUI::ListViewBaseItem::OnRightTapped. That calls spListView->FocusItem to shift focus back to the ListViewItem. We queue a (asynchronous) focus lost event on the Popup.
Now we're racing. Eventually the flyout will finish loading and call FlyoutBase::OnPresenterLoaded (Loaded events are synchronous). That shifts focus back to the CPopup with PopupAsNative->SetFocus. This synchronous Loaded event is racing with the async focus lost.
Meanwhile, the async FocusLost event comes in and calls FlyoutBase::OnPopupLostFocus. That method checks the element currently with focus - if Loaded completed, it'll be the CPopup. Otherwise, it'll still be the ListViewItem. If focus is on the CListViewItem, we'll call Hide() at the end of OnPopupLostFocus and hide the popup immediately after showing it. This is what causes the popup to never show up. In order for the popup to show up, the synchronous Loaded event must win the race against the async FocusLost event. We don't have any guarantees about how fast the Flyout loads, though.