I just compiled and ran the code you posted and I see the same behavior basically. I figured why it could be missed. I select multiple items, then if I right-click and I happen to have the cursor over the item in the selection that has the dashed outline around (i.e. the last addition to the extended selection) then that becomes the selected item. (Just before the context menu is displayed). If I right-click anywhere else the selection is not changed. It seemed like it always happened to me because that is typical of my use - I will select multiple items and invoke the context menu immediately with the cursor over the last selected item.
Still, it seems like a bug.
Bookmarks