JDK-8193311 : [Spinner] Default button not activated on ENTER
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8u40,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-12-11
  • Updated: 2024-07-26
  • Resolved: 2018-04-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
This is analogue to JDK-8096725 (was fixed for ComboBox and DatePicker), just for Spinner and only for ENTER (ESC is working as expected, at least in regard to the cancel button)

To reproduce, take the example from that bug, add an editable spinner:

// JW: added spinner
Spinner<Integer> spinner = new Spinner<>(0, 200, 20);
spinner.setEditable(true);
...
vbox.getChildren().add(spinner);

then run, 
- edit spinner
- press enter
- expected: okay button activated, that is OK printed
- actual: nothing happens

Comments
Changeset: 4fc4c393fdc6 Author: arapte Date: 2018-04-04 18:36 +0530 URL: http://hg.openjdk.java.net/openjfx/jfx-dev/rt/rev/4fc4c393fdc6 8193311: [Spinner] Default button not activated on ENTER Reviewed-by: kcr, aghaisas
04-04-2018

+1
26-03-2018

+1
23-03-2018

Hi Kevin, Thanks for the review comments, Corrected both 1 & 2. Please take a look at the updated webrev: http://cr.openjdk.java.net/~arapte/fx/8193311/webrev.01/
22-03-2018

[~arapte] Finally getting to this... The fix is simple enough, and works in the cases I've tested. I note that it works slightly differently from the want ComboBox does it. In the case of Spinner, we now fire a new event, and don't consume the original event. I think this is OK, but Ajit should look at it, too. I have two minor comments on the test: 1. I recommend adding a message string to the assertTrue statements in the new test. 2. Please use an initial lower letter for the two new instance variables that you added (to match our coding style)
09-03-2018

Hi Kevin & Ajit, Please review the fix: http://cr.openjdk.java.net/~arapte/fx/8193311/webrev.00/ Cause: The ENTER key event gets consumed by spinner control. Fix: Do not consume the ENTER key at spinner control. Unlike ESCAPE key, the ENTER key event has to be passed to TextField, i.e. textField.fireEvent(ke.copyFor(textField, textField)); should executed for ENTER key event. Hence the return statement is added after the call. Verification: Added a unit test. No existing unit test fails due to this change.
22-01-2018