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 148268 - ENTER invokes default button instead of focused button
Summary: ENTER invokes default button instead of focused button
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
: 187365 (view as bug list)
Depends on:
Blocks: 204066
  Show dependency tree
 
Reported: 2008-09-24 17:59 UTC by bjorneriknord
Modified: 2012-08-14 14:17 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bjorneriknord 2008-09-24 17:59:37 UTC
The bug is present when you as a user navigate a dialog without a mouse (just using your keyboard) and this dialog has  
a default button. Lets say that the dialog have the two buttons OK and Cancel where OK is default. You use TAB in order 
to focus on the CANCEL-button and then press ENTER. Instead of invoking the CANCEL-button as expected, you instead 
invoke the default OK-button.

Try
1. Navigate->Go to type...
2. Type something in order to enable the OK-button
3. Press Shift-TAB in order to focus the Cancel-button. At this point you can see that the OK-button still is 
"default". Normal behavior on Windows is to make the Cancel-button look default at this moment.
4. Hit ENTER and notice that the OK-button is invoked instead of the expected Cancel-button. If you however press TAB, 
the Cancel-button is invoked.

I experience the same effect when using NotifyDescriptor/DialogDisplayer in my netbeans platform application and my 
users are confused since they think that they have canceled an operation.
Comment 1 bjorneriknord 2008-09-24 18:03:14 UTC
Note four should have been..

4. Hit .... If you however press ====>>> SPACE <<<====, the Cancel-button is invoked.
Comment 2 Peter Pis 2008-09-24 20:28:18 UTC
Reassigning to utilities for evaluation.
Comment 3 Petr Hrebejk 2008-09-24 21:16:06 UTC
Is it Go To type specific or is it default behavior for all dialogs in NetBeans?
Comment 4 Jan Becicka 2008-09-25 09:45:44 UTC
> I experience the same effect when using NotifyDescriptor/DialogDisplayer in my netbeans platform application and my 
> users are confused since they think that they have canceled an operation.

Isn't it default behavior?
Comment 5 Lukas Hasik 2008-09-25 10:25:09 UTC
IMO, the ENTER and ESC are reserved for default confirm and cancel buttons. It worked in the same way in 6.1
Comment 6 bjorneriknord 2008-10-14 21:57:39 UTC
Perhaps I misunderstand the INVALID resolution but if it means that you do not consider this a bug, let me try to 
convince you;-)

NetBeans does not follow standard Microsoft Windows way to handle this. Perhaps it is the standard of Mac or Linux but 
not Windows. This will make my users confused. When you focus a button (no mouse involved) and press ENTER you always 
invoke that button disregarding default buttons. You could for example try the print-dialog from Microsoft Word or 
Open Office. When you have focus on a button and press ENTER, that button is always pressed disregarding the default 
button.

I would say that this problem is in all the NetBeans dialogs. If you for example select Ctrl-Shift-F to invoke Edit-
>Find in Projects and type "something". Your dialog will now have "Find", "Close" and "Help" as buttons in the dialog. 
If you shift-Tab to focus the Help button and press ENTER, you do expect the help to be presented. Instead you have 
envoked the default Find-button.

A more extrem example is if I where to create my own dialog in my RCP-application with the default button "Yes" 
followed by "No" and "Help". If I then use that dialog and ask my user "Do you really want to delete everything?". My 
experienced Microsoft Windows user would then be very suprised when he pressed ENTER on the focused "No"-button if 
that action wiped out the content of the database.

Kindest regards,

Björn
Comment 7 bjorneriknord 2008-10-15 20:22:27 UTC
Another example where you as a user of NetBeans can experience this while editing a java-class.

1. Edit your clss without a mouse
2. Press Ctrl+W in order to close it when it contains unsaved changes.
3. The dialog asks you "File xxx.java is modified. Save it ?" You are now focused on the default "Save" button.
4. Press TAB and focus "Discard"-button. Save-button is no longer default. Press ENTER now to discard your changes. 
This is the expected MS Windows behaviour.
5. If you instead TAB once more in order to focus the "Cancel"-button, the Save-button is still marked as default. 
Pressing ENTER at this stage will save the file instead of the expected cancelation.

With hopeful regards,

Björn
Comment 8 bjorneriknord 2008-10-29 15:30:05 UTC
Where it works...

In the refactor-dialogs everything works as expected. If I for exemple...

1. Select something in my java-code and and press Ctrl+R in order to rename that something I get the "Rename"-dialog 
where the "Refactor"-button is default
2. I Shift-tab to focus the "Help-button".
3. I press <ENTER> and invokes the expected help-button

Kindest regards,

Björn
Comment 9 Lukas Hasik 2008-10-29 15:49:11 UTC
Jano, could you comment on last bjorn's comments?
Comment 10 jrojcek 2008-10-30 16:29:21 UTC
Similar issue has already been reported:
http://www.netbeans.org/issues/show_bug.cgi?id=50803

NetBeans is really inconsistent with Win XP in this regard. For users used to using keyboard for navigating in dialogs on Win XP, this is certainly a problem. 
Ideally Swing would automatically adjust focus behavior depending on the OS platform. Is something like that happening in some of the dialogs (Refactor) as 
indicated by bjorn?
Comment 11 Jiri Rechtacek 2008-11-21 15:28:06 UTC
I'll look on it again.
Comment 12 Grimalkyne 2010-06-09 08:15:15 UTC
This bug still exists in 6.8 even though the target milestone is 6.7
Are there any plans to fix it?

Thanks
Comment 13 Grimalkyne 2010-06-09 08:18:32 UTC
*** Bug 187365 has been marked as a duplicate of this bug. ***
Comment 14 craigmarshall 2010-06-11 10:15:39 UTC
This has come up several times in our RCP application accessability and usability sessions, I checked 6.9 and its still present.

Could anyone comment when / if its to be fixed?
Comment 15 Stanislav Aubrecht 2011-10-17 14:41:57 UTC
core-main ab3f293d62c6
Comment 16 Jesse Glick 2011-10-18 13:40:58 UTC
This fix is wrong; you cannot just call setDefaultCapable on every button, because many are never supposed to be default capable.

Concrete regression: New Project wizard; NetBeans Module / Module, Next; use default Name, Next. Now on the third panel, Next and Finish are both disabled, since "Please specify code name base" appears. Previously, no button was set as default in this case, and ENTER did nothing, which was correct. Now, Help is set as default (visible border on button) and ENTER opens the help browser, which is wrong.
Comment 17 Stanislav Aubrecht 2011-10-19 10:21:20 UTC
core-main d93a25a3a99c
Comment 18 Quality Engineering 2011-10-19 14:19:03 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/ab3f293d62c6
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #148268 - ENTER key must invoke focused button instead of the default one
Comment 19 Jan Becicka 2011-10-21 14:29:54 UTC
*** Bug 204066 has been marked as a duplicate of this bug. ***
Comment 20 Quality Engineering 2011-10-24 14:07:00 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/d93a25a3a99c
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #148268 - no default button when the default button is disabled
Comment 21 gloin 2012-08-14 13:45:21 UTC
Reopened, because I experience the same issue with NB 7.2 in all dialogs I tried.

Example:
In the file browser / project browser choosing to delete a file will open a confirmation dialog ("Confirm Object Deletion").
Tabbing to "No" and pressing ENTER will delete the file anyway, because the default button is "Yes" (happend to me, only mild damage done).
Pressing SPACE works correctly.

-----
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_24; OpenJDK Client VM 20.0-b12
System: Linux version 3.0.0-24-generic running on i386; UTF-8; de_DE (nb)
Comment 22 Stanislav Aubrecht 2012-08-14 14:17:44 UTC
File chooser and Project chooser windows do not use NetBeans Dialogs API.