On Mon, 23 Mar 2026 15:48:21 GMT, Dmitry Markov <[email protected]> wrote:

> On macOS the menuBar with a custom menu item may disappear. For example, once 
> switching from the menu with custom item to the system menu. 
> 
> The method `rebuildUI()` in `MenuBarSkin` class clears the menu first, then 
> `menuContainsCustomMenuItem()` correctly blocks promotion to the macOS system 
> menu and prints warning. However `rebuildUI()` returns at line 917: 
> `isUseSystemMenuBar()` returns true but the menu cannot be installed into 
> system menu due to `CustomMenuItem`. As a result the menu bar disappears.
> 
> Fix:
> The `rebuildUI()` has to ensure that the menu does not contain 
> `CustomMenuItem` when switching to the system menu.
> 
> On a side note, for the working scenario described in the bug the same 
> _if-statement_ in `rebuildUI()` woks slightly different: the 
> `currentMenuBarStage` is not _NULL_ but it no longer maps to this skin as a 
> result the method does not return earlier and the menu gets rebuilt.

This pull request has now been integrated.

Changeset: 527f8bdc
Author:    Dmitry Markov <[email protected]>
Committer: Andy Goryachev <[email protected]>
URL:       
https://git.openjdk.org/jfx/commit/527f8bdcfbd85faee3e970e932522b7cc624ecf8
Stats:     4 lines in 1 file changed: 1 ins; 0 del; 3 mod

8351094: macOS: MenuBar with custom menu items disappears

Reviewed-by: angorya, mfox

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

PR: https://git.openjdk.org/jfx/pull/2125

Reply via email to