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.
Summary: | Keyboard focus is wrong in license dialog | ||
---|---|---|---|
Product: | platform | Reporter: | _ tboudreau <tboudreau> |
Component: | Window System | Assignee: | issues@platform <issues> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | jchalupa, jglick, mmirilovic, pchytil |
Priority: | P3 | Keywords: | A11Y, FOCUS, SIMPLEFIX |
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
_ tboudreau
2006-01-04 20:37:15 UTC
I'm not sure where this belogs... please evaluate. Belongs to Marek AFAIK, not sure which component though. Reproducible on Lin ... Jesse in issue #64286 asked to put focus on license text. (Logical as user should first review whole license text.) As focus cannot be at 2 places at the same time please agree on right place for initial focus. Agreed, the user has to be forced to go through the text. I think it's usual way Licence Agreement dialogs do. I tend to disagree (since nobody actually reads the license text in practice unless they're a license nut), but regardless, the next stop from the license field shouldn't be the scrollbar. I've seen it done both ways - many apps put focus on the accept button, not the license. And if we really want to have the best of both worlds, take the down and up arrow key actions and bind them in the JRootPane of the dialog so up and down arrows work no matter where focus is. Re. focus going to the scrollbar - this is at the discretion of the LaF. JDK 1.4 will send focus to the scroll bar. As of JDK 5's Ocean it does not do this. At least it works for me in 5.0u6 and Mustang - pressing TAB once puts focus on the Accept button. There is a mnemonic for Accept so you do not need to tab to it. Presumably this is not available on Macs, but if you use a Mac you are volunteering to use the mouse. Better might be to have no mnemonic for Accept but have it be the default button so Enter works, and have no mnemonic for Exit since it matches behavior of window close. (Cf. JLF guidelines.) Binding Up and Down (and Page Up and Page Down) to corresponding actions in the text field would work too, but it's extra work. For "have no mnemonic for Exit" read "have no mnemonic for Exit but bind ESCAPE", which is what the JLF (and common sense) prescribes. Don't see any jusitification for this to be P2. If you are using a modern JDK, and you press TAB, you get focus sent to a button which you can press SPACE on; or you can use Alt-A to begin with (on non-Mac platforms); or you can click with the mouse, as most people probably do anyway since this dialog is not part of routine daily workflow. > Re. focus going to the scrollbar - this is at the discretion of the LaF. JDK > 1.4 will send focus to the scroll bar. I was using 1.4 when I encountered this, for reasons irrelevant here. > There is a mnemonic for Accept so you do not need to tab to it. Mnemonics are not visible by default on win xp - not discoverable enough. > Better might be to have no mnemonic for Accept but have it be the default > button so Enter works Haven't tried it, but AFAIK in any text control but a JTextField, it's Ctrl- Enter, not Enter that invokes the default button. A little non-intuitive. > Don't see any jusitification for this to be P2. A user's very first invocation of NetBeans shouldn't start with a dialog in which there is no obvious focus invocation, and in which keyboard interaction is not utterly intuitive. That's the reason I made it P2. "Mnemonics are not visible by default on win xp" - exactly. They appear if and when you press Alt. If you're a KB user on Windows you are presumably accustomed to pressing Alt when you are looking for mnemonics. "in any text control but a JTextField, it's Ctrl-Enter, not Enter that invokes the default button" - yes, and it appears that's true even for noneditable text fields. Fortunately it is easy to work around, e.g. import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.KeyStroke; public class X extends javax.swing.JFrame { public X() { initComponents(); getRootPane().setDefaultButton(accept); getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("ESCAPE"), "exit"); getRootPane().getActionMap().put("exit", new AbstractAction() { public void actionPerformed(ActionEvent e) { System.out.println("exited"); } }); pane.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "accept"); pane.getActionMap().put("accept", new AbstractAction() { public void actionPerformed(ActionEvent e) { System.out.println("accepted"); } }); } // <editor-fold defaultstate="collapsed" desc=" Generated Code "> private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); pane = new javax.swing.JEditorPane(); exit = new javax.swing.JButton(); accept = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); pane.setEditable(false); pane.setText("Blah blah blah\nblah blah blah\nho ho ho"); jScrollPane1.setViewportView(pane); exit.setText("Exit"); exit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitActionPerformed(evt); } }); accept.setText("Accept"); accept.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { acceptActionPerformed(evt); } }); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .add(accept) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(exit)) .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() .addContainerGap() .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(exit) .add(accept)) .addContainerGap()) ); pack(); }// </editor-fold> private void acceptActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("accepted"); } private void exitActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("exited"); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new X().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton accept; private javax.swing.JButton exit; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JEditorPane pane; // End of variables declaration } I recall on Linux, Solaris and Windows (where we provide regular installer) this dialog is displayed ONLY when user does not use regular installer but use zip distribution. (User must accept license in installer.) On these platforms only minority of users do not use installer. On Mac OS X it is different as we provide InstallShield installer only for asbundle. For NetBeans IDE we provide tar ball (equivalent to zip distrobution) so user will see this dialog. Mnemonic on Win L&F: Yes mnemonic is visible only when you press Alt but it is default for all mnemonic (buttons, menus,...) so I do not see any reason why to complain it is less visible. Is solution to make Enter selecting Accept button enough for this issue? Many thanks go to Jesse for hint. :) moving opened issues from TM <= 6.1 to TM=Dev Marku, any update on this issue? I think there should really be the possibility to scroll up/down by arrows. Now there is the workaround for reading of whole text by using PgUp/PgDown. - 'accept' is now default button, pressing enter while editor pane has input focus accepts the license - 'escape' key rejects the license - up/down arrows scroll license text (not the caret position) core-main 1ffeb1b65371 Integrated into 'main-golden', will be available in build *200909111401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/1ffeb1b65371 User: S. Aubrecht <saubrecht@netbeans.org> Log: #71018 - make 'accept license' dialog window more keyboard friendly |