On Fri, 11 Sep 2026 05:47:41 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> Test is failed on windows citing that popup menu opened when mouse button is 
>> pressed and hold, 
>> doesn't get dismissed when mouse button is released outside the component 
>> area
>>  and pressing "Escape" key is needed to dismiss the popup
>> 
>> It is seen that in the test, PopupMenu.show() is invoked from mousePressed()
>> On Windows, the native peer uses a modal popup-menu [tracking 
>> loop](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-trackpopupmenu).
>>  Because the menu is opened while the button is already down, the subsequent 
>> mouseReleased is not an outside-menu click that dismisses the native menu
>> The menu remains active until cancellation (Escape) or another menu action 
>> like selecting a menuitem.
>> It seems to be normal Win32 behaviour. TrackPopupMenu explicitly tracks user 
>> selection and delivers menu interaction to its owning window.
>> 
>> Linux/macos happens to treat that release as a dismissal, so the test 
>> instruction incorrectly assumes the Linux interaction model applies 
>> everywhere.
>> The test currently says a popup which “stays up and grabs all input” is a 
>> failure. On Windows, that condition is expected for a displayed native popup.
>> 
>> I have attached a native Win32 program in JBS which invokes TrackPopupMenuEx 
>> synchronously from WM_LBUTTONDOWN, equivalent to calling PopupMenu.show() 
>> from Java’s mousePressed().
>> If we press and hold the left button in either colored area, move outside 
>> the menu, and release, then the popup remains visible until Escape, 
>> selection, or a subsequent click—demonstrating the normal Win32 native-menu 
>> tracking behavior.
>> 
>> so the fix is made to not run the test in windows
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Prasanta Sadhukhan has updated the pull request with a new target base due to 
> a merge or a rebase. The pull request now contains four commits:
> 
>  - DePL
>  - Merge master
>  - Merge master
>  - 8340022: java/awt/PopupMenu/PopupHangTest/PopupHangTest.java fails on 
> windows

Marked as reviewed by azvegint (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/32699#pullrequestreview-5180587639

Reply via email to