On Fri, 4 Sep 2026 08:34:29 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).

Marked as reviewed by kizune (Reviewer).

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

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

Reply via email to