On Tue, 31 Oct 2023 20:01:39 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> The fix prevents the DatePicker from losing focus if the date is not 
>> parsable.
>
> modules/javafx.controls/src/main/java/javafx/scene/control/DatePicker.java 
> line 159:
> 
>> 157:      * This is to address https://bugs.openjdk.org/browse/JDK-8303478
>> 158:      */
>> 159:     protected void commitValueOnFocusLost(){
> 
> The `protected` modifier makes this method public API, which would most 
> likely require a CSR to be approved. Since there doesn't seem to be a reason 
> why this method should be public, I suggest making it private instead.

ok, I have changed it to private

> modules/javafx.controls/src/main/java/javafx/scene/control/DatePicker.java 
> line 163:
> 
>> 161:             commitValue();
>> 162:         } catch (DateTimeParseException dtpe) {
>> 163:             this.requestFocus();
> 
> I'm not sure whether moving focus to the control is a good idea, because this 
> effectively captures focus and forces me to enter a valid date before I can 
> do anything else. Why not just restore the previous value instead?

I have changed the behavior as you suggested.
The downside is that user might not notice that his/her changes were replaced, 
but it is anyway consistent to what happens when typing ENTER.

Robot test is updated accordingly.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1274#discussion_r1378511728
PR Review Comment: https://git.openjdk.org/jfx/pull/1274#discussion_r1378691165

Reply via email to