This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 17548 - Alt-<<letter>> to post main menus sometimes runs first item instead
Summary: Alt-<<letter>> to post main menus sometimes runs first item instead
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: _ ttran
URL:
Keywords: A11Y
: 13672 18754 19563 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-11-12 12:32 UTC by Jesse Glick
Modified: 2008-12-23 13:34 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch for release33 (only jdk1.4) (2.61 KB, application/octet-stream)
2002-01-21 17:08 UTC, _ ttran
Details
diff against release33 (2.13 KB, patch)
2002-01-21 17:10 UTC, _ ttran
Details | Diff
a better patch for release33 (2.63 KB, application/octet-stream)
2002-01-21 17:45 UTC, _ ttran
Details
final jar patch for release33/jdk 1.3 (4.43 KB, application/octet-stream)
2002-01-21 22:05 UTC, _ ttran
Details
final jar patch for release33/jdk 1.4 (2.62 KB, application/octet-stream)
2002-01-21 22:06 UTC, _ ttran
Details
final diff against release33 for jdk 1.3 (1.27 KB, patch)
2002-01-21 22:08 UTC, _ ttran
Details | Diff
final diff against release33 for jdk 1.4 (3.25 KB, patch)
2002-01-21 22:10 UTC, _ ttran
Details | Diff
a better "final" jar patch for release33/jdk 1.4 (2.62 KB, application/octet-stream)
2002-01-21 22:46 UTC, _ ttran
Details
a better "final" diff against release33 for jdk 1.4 (3.23 KB, patch)
2002-01-21 22:47 UTC, _ ttran
Details | Diff
yet another jar patch for release33/jdk 1.4 (2.68 KB, application/octet-stream)
2002-01-22 13:40 UTC, _ ttran
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-11-12 12:32:29 UTC
[dev nov 12, and observed for a few days only, I think starting w/ dev
nov 8? Enlightenment, JDK 1.3.1_01] In recent builds, sometimes
posting a menu via KB command actually runs the first item instead.
For example, I press Alt-T from the Editor and rather than posting the
Tools menu, the Go To Class dialog is opened (first in the list). At
the same time, Alt-W correctly opens the Window menu and Left moves
into the Tools menu normally. This problem does not occur immediately
after starting the IDE, it only starts to happen after having used the
IDE for a while (and then does not go away until the IDE is
restarted). I think I have only observed it with the Tools menu,
though I am not sure.
Comment 1 _ ttran 2001-11-12 14:29:55 UTC
This is a long time JDK issue, not NB.  Alt+<letter> actually produces
two key events (at least): Alt+<letter> and <letter>.  It means
pressing Alt+T produces a sequence of Alt+T, which invokes the Tools
menu, then T which invokes the menuitem under Tools which has T as
mnemonic.  I ran into this problem almost three years ago (it was
&Help | &Help Contents).  I worked around it by removing mnemonic of
Help Contents.

We may want to invetigate the issue.  I suspect that the superfluous
<letter> event is KEY_RELEASED <letter> and mnemonic handling reacts
to KEY_RELEASED.  Just a blind guess.
Comment 2 Jesse Glick 2001-11-12 17:09:57 UTC
Strange that I would just start noticing this issue. Specific to
1.3.1_01? Something we changed in focus management? New/changed
mnemonics on common actions?

Anyway, it is rather annoying, maybe it merits a workaround. E.g. for
org.openide.awt to refuse to add a mnemonic to any menu item which is
the same as the mnemonic of the menu it is in.
Comment 3 _ ttran 2001-11-14 08:36:16 UTC
Okay, reopen.  We may want to do something with this bug.
Comment 4 Jesse Glick 2001-11-14 09:42:48 UTC
I can confirm it happens for other menus too, and always where the
item's mnemonic matches the menu's own. Again, it does not occur
consistently; in a given IDE session all is well for a while. I have
yet to figure out what triggers the bug to start appearing.
Comment 5 _ ttran 2001-11-22 15:27:29 UTC
just want to stress again this is JDK/OS problem.  We'll try to find a
workaround but there is no guarantee.
Comment 6 Jan Chalupa 2001-11-27 11:52:12 UTC
Target milestone -> 3.3.1.
Comment 7 Jan Chalupa 2001-11-27 11:56:03 UTC
Target milestone -> 3.3.1.
Comment 8 _ ttran 2001-12-20 09:17:03 UTC
*** Issue 18754 has been marked as a duplicate of this issue. ***
Comment 9 Marian Mirilovic 2001-12-20 16:35:04 UTC
*** Issue 13672 has been marked as a duplicate of this issue. ***
Comment 10 Todd Tidwell 2001-12-20 18:13:02 UTC
This happens in Windows as well and in Netbean 3.2.1 and 3.3. I 
submitted the same bug early last week.  It seems that you all think 
it's a jdk bug, but this doesn't seems to happen in Forte using the 
same JDK.

I've also, after further examination, noticed that I can you Alt-E 
*once* after I start netbeans.  then, when I hit C, it does the copy 
like it should.  From that point on, Alt-E refuses to work.

Comment 11 _ ttran 2001-12-21 13:04:12 UTC
Step to reproduce (at least on my Linux + jdk 1.3.1_01)

  - start the IDE in SDI mode
  - open some file in an editor
  - switch to MDI (Tools->Setup Wizard)
  - mouse click to the editor (to focus it), press Alt+T, the menuitem
    "Go &To Class" is invoked immediately.  It shouldn't, instead the
    Tools menu popup should be displayed waiting for the user to
    select a menuitem

Possible workaround:

  when this starts happening the user can use mouse to pull down any
  menu from the main menu bar, go around with it using mouse.  Then
  Alt+T will behave as normal

Evaluation:

  I spent a whole lot of time investigating this bug.  Strongly
  suspect that some Swing internal data are corrupted for some reason.
  Probably an AWT/Swing bug.  Any fix would be hacky and it works fine 
  on JDK 1.4.

I suggest we won't fix this bug.
Comment 12 _ ttran 2002-01-18 10:17:06 UTC
*** Issue 19563 has been marked as a duplicate of this issue. ***
Comment 13 Jiri Mzourek 2002-01-18 10:32:21 UTC
I've tried NetBeans 3.2 on JDK1.3.1 on my Linux and everything seems
to work OK.
Comment 14 Jesse Glick 2002-01-18 11:53:13 UTC
It still happens to me on 1.3.1_02, and it happened to me on 1.4 beta
3, so I disagree that it is fixed in 1.4. I agree it is dangerous to
try to fix the problem directly. However we can consider, for example,
a special system property hack which would turn on a mode where no
menu item would get a mnemonic matching its menu. Basically the
Actions.MenuBridge presenter would check for the containing JMenu and
disable problematic mnemonics. This would ensure that the bug was not
triggered.

Does it sound worth the effort? I have become so used to invoking the
main menu with Alt-V (View menu is mnemonic-safe) and then continuing
to the menu I want with its mnemonic (e.g. Alt-V B B to build), that I
can't estimate how much of an impact this bug has on an average user.
Mostly confusion, I guess.

Note: Alt-E seems to do nothing because ReplaceAction is invoked, but
it is disabled.
Comment 15 Jiri Mzourek 2002-01-18 16:00:02 UTC
Reopened. We've tried it on Solaris8, JDK1.4 (two independent
machines) and the problem occured every time.
Comment 16 Jiri Mzourek 2002-01-18 16:16:52 UTC
We have tried it on Windows2000 (two machines), on JDK1.3.1 there are
not problems, on JDK1.4 is the same behavior as on Solaris (everytime).
Comment 17 Jiri Mzourek 2002-01-21 09:58:19 UTC
Increased to P2. This is a regression, now (3.3rc2) the problem
occures every time, not sometimes as was described. 
From usability and accessibility point of view this bug has very high
priority.

I've written simple application with a menu. When I run it by external
execution, it works OK, when by internal, there is the same problem as
in NetBeans menu.
Comment 18 _ ttran 2002-01-21 13:15:34 UTC
Man, this is not a regression.  The only fact that you're now able to
reproduce the bug reliably does not mean that we broke something in
the code recently.  Please don't overuse the word.
Comment 19 _ ttran 2002-01-21 16:12:26 UTC
KEY_TYPED events are generated even for Alt-T.  Such an event should
be generated only when the key stroke produces a Unicode character,
which it doesn't in our case but KEY_TYPED is generated anyway.  Mila
knows about this problem for a long time and has a hackaround for it
in the editor.  He basically ignores any KEY_TYPED which has modifiers
!= Alt+Ctrl (==RightAlt).  This of course doesn't work on MacOS, but
probably too much technical details....
Comment 20 _ ttran 2002-01-21 17:08:09 UTC
Created attachment 4317 [details]
patch for release33 (only jdk1.4)
Comment 21 _ ttran 2002-01-21 17:10:54 UTC
Created attachment 4318 [details]
diff against release33
Comment 22 _ ttran 2002-01-21 17:13:43 UTC
please test the patch on all platforms with jdk 1.4 only, there is no
impact when ide runs on jdk 1.3.  Things to test besides verifying
that the patch really fixed the problem: MDI/SDI, typing national
characters in the editor especially with RightAlt, popups of all types
including combobox popups

dstrupl already reviewed my fix
Comment 23 _ ttran 2002-01-21 17:45:19 UTC
Created attachment 4320 [details]
a better patch for release33
Comment 24 Lukas Hasik 2002-01-21 18:37:45 UTC
OK, new patch tested. 
Main problem is gone but one smaller bug still remains. This bug
appears only in Explorer - when menu invoked from KB and in Explorer
exist node with same first letter then this node is selected except
origin selection. This is annoying for user. e.g. CVS menu is invoked
but for different node than user wanted(wrong file could be commited
to CVS if s/he  didn't notice that node selection changed) etc.
Comment 25 _ ttran 2002-01-21 21:59:53 UTC
Okay, I am going to add a (hopefully) final patch.  As I mentioned
earlier the root of all evil is the bug in JVM (I believe) which
produces an extra KEY_TYPED event even though it shouldn't.  This
extra event invokes various unexpected actions.  The relevant piece of
code in NB is different for JDK 1.4 and JDK 1.3 so the symptoms are
different but the root cause is the same.

The current situation is that I have the hacks for both JDK 1.4 and
JDK 1.3.  The bug on JDK 1.3 is less severe (not a showstopper) so
perhaps we'll decide to integrate only the hack for JDK 1.4

I'll going to attach all I have.  What needs to be tested:

- MDI/SDI
- invoking/navigating popup menus
- invoking/navigating pulldown menus (from the main menubar)
- combobox popups
- shortcuts in general
- shortcuts in dialogs (modal and non-modals)

Of course if one uses only the patch for JDK 1.3 then only JDK 1.3
should be tested (ditto for the patch for JDK 1.4)

[Lukas Hasik wrote]
> This bug appears only in Explorer - when menu invoked from KB and in
Explorer
> exist node with same first letter then this node is selected except
origin selection

this is not NB-specific.  Try the same thing with JDK 1.4/SwingSet2
demo.  The patch I am going to attach to this bug report also works
around this problem.
Comment 26 _ ttran 2002-01-21 22:05:13 UTC
Created attachment 4323 [details]
final jar patch for release33/jdk 1.3
Comment 27 _ ttran 2002-01-21 22:06:57 UTC
Created attachment 4324 [details]
final jar patch for release33/jdk 1.4
Comment 28 _ ttran 2002-01-21 22:08:37 UTC
Created attachment 4325 [details]
final diff against release33 for jdk 1.3
Comment 29 _ ttran 2002-01-21 22:10:33 UTC
Created attachment 4326 [details]
final diff against release33 for jdk 1.4
Comment 30 _ ttran 2002-01-21 22:43:02 UTC
weird things happen in Dialog on JDK 1.4.  I need to be more
conservative with the hack, going to attach a better "final" jar patch
for jdk 1.4
Comment 31 _ ttran 2002-01-21 22:46:31 UTC
Created attachment 4328 [details]
a better "final" jar patch for release33/jdk 1.4
Comment 32 _ ttran 2002-01-21 22:47:32 UTC
Created attachment 4329 [details]
a better "final" diff against release33 for jdk 1.4
Comment 33 _ ttran 2002-01-22 13:40:48 UTC
Created attachment 4339 [details]
yet another jar patch for release33/jdk 1.4
Comment 34 dpavlica 2002-01-22 14:14:00 UTC
I have tried to change menmonic in submenus and it's working with 
this associations:
Edit> Rep&lace
Project> P&roject Manager
Build> B&uild
Debug> D&ebugger Window
Versioning> Run &CVS Command
Windows> W&indows
Tools> Go To Class ...without mnemonics because of many conflicts

I didn't use any patch included above.
Comment 35 Jan Zajicek 2002-01-22 14:49:36 UTC
Attachment id=4339 - a better "final" jar patch for release33/jdk 1.4
tested by me, Lukas and Marian. We consider this patch as the best
from all presented. However there is one small issue, that we now do
not see as showstopper: When some main menu is opened (e.g. File),
pressing mnemonic for another main menu (e.g. alt+t for Tools) invokes
associated action in the menu (Go to class dialog). This can be
workarounded by invoking the new desired menu after the previous is
closed. Main problem seems to be fixed, new small one with suitable
workaround exists, so we vote for the latest patch.

Comment 36 Jesse Glick 2002-01-22 14:56:20 UTC
"When some main menu is opened (e.g. File), pressing mnemonic for
another main menu (e.g. alt+t for Tools) invokes associated action in
the menu (Go to class dialog). This can be workarounded by invoking
the new desired menu after the previous is closed." - if you have
pressed Alt-F to post the File menu, and then press just T (not
Alt-T), does the Tools menu correctly post, as works without the patch
(and was my workaround for this bug - press Alt-V then the mnemonic of
the problematic menu)?

Also has anyone besides Trung tested the 1.3 patch yet? I have not
gotten a chance to yet.
Comment 37 Marian Mirilovic 2002-01-22 14:58:38 UTC
Small correction:

- you can open some popup menu (not only Main menu) and if you press
Alt + (Main menu mnemonic) , invoke associated action in the menu :

1. open Source Editor
2. Shift-F10
-> popup menu arise
3. Alt-E
-> "Replace" dialog arise
Comment 38 Marian Mirilovic 2002-01-22 15:10:17 UTC
The same result for Combobox popups.
Comment 39 _ ttran 2002-01-22 15:50:20 UTC
fixed in release33 and trunk, I've already got approvals
Comment 40 Jan Chalupa 2002-01-22 18:23:44 UTC
QA approves the 2002-01-22 05:40 PST patch for 3.3.1.
Comment 41 Jan Chalupa 2002-01-23 12:49:35 UTC
Steps to reproduce another minor issue:

1. Open Tools | Options
2. Expand the Editing | Editor Settings node.
3. Select the Indentation Engines node
4. Press Alt-H
The help viewer should come up and display the Indentation Properties
info. Instead, Alt-H selects the HTML Editor node first and then
displays help for the Source Editor Properties.
Comment 42 Jan Zajicek 2002-01-24 12:05:57 UTC
Marking as verified. The patch works however there are some minor
issues that seems to be unfixable - check number of patches where each
fixed only part of the problem not whole.

To Jesse: Yes after pressing just T works. Also your workaround to
pres alt+v and then the mnemonic works.
Comment 43 Jan Zajicek 2002-01-24 12:39:35 UTC
Putting 3.3.1_CANDIDATE keyword back - reload function doesn't refresh
all fileds so when I commited changes to this issue the keyword was
wrongly removed.
Comment 44 _ ttran 2002-01-24 15:49:53 UTC
the JTree thing is a bug in JDK, demonstratable with the SwingSet2
demo.  Can someone please take time and file a bug against JDK 1.4? 
Thanks!!
Comment 45 Jesse Glick 2003-02-12 16:36:33 UTC
Just observed this again in [dev feb 11] with the Help menu - pressed
Alt-H and it opened the master help set rather than just posting the
Help menu. Of course this is not reproducible. :-(
Comment 46 Quality Engineering 2003-07-01 16:12:32 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.