apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.67k stars 855 forks source link

Critical focus bug when accessing main menu from floating pane #7952

Open nmatt opened 5 days ago

nmatt commented 5 days ago

Apache NetBeans version

Apache NetBeans 23

What happened

Summary: When making a pane in the NetBeans UI a floating pane (basically a separate window), then invoking the main menu via keyboard from the floating pane changes the focus back to the main window, and the menu loses keyboard focus. In consequence, it's impossible to perform menu actions for items in a floating pane.

This is a regression in NetBeans 16-23. This had worked since at least NetBeans 8 up to NetBeans 15, and stopped working with NetBeans 16.

This bug makes it impractical to use floating panes in conjunction with keyboard navigation and/or to select actions from the main menu that work on items in the floating pane, such as "Close " in the "How to reproduce" example below, or also actions like Team > Commit.

Language / Project Type / NetBeans Component

NetBeans UI, any project type

How to reproduce

What works:

What does NOT work:

Did this work correctly in an earlier version?

Apache NetBeans 15

Operating System

Windows 10

JDK

Any JDK, specifically tested under 8, 11, 17, and 21

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

This bug may be a side effect of https://github.com/apache/netbeans/pull/4603. I had originally already reported this as https://github.com/apache/netbeans/issues/5062.

I'm willing to help any way I can in implementing a fix. This is an important issue to me and has held me back from upgrading from NetBeans 15.

Are you willing to submit a pull request?

Not at the moment, but possibly eventually.

nmatt commented 5 days ago

@errael: It would be great if you could take a look at this, if it's an unintended side effect of https://github.com/apache/netbeans/issues/4437.

neilcsmith-net commented 4 days ago

Can reproduce. Added the NB25 milestone. Don't think it's urgent enough for NB24.

At a guess, if this is caused by #4603 , it might be due to either listening on the wrong property (should be permanent focus owner?) and/or not checking that the focused component is inside a TopComponent.