JDK-8198606 : Touch keyboard does not hide, when a text component looses focus
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u172,10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • Submitted: 2018-02-23
  • Updated: 2019-01-14
  • Resolved: 2018-03-13
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.
JDK 11 JDK 7 JDK 8
11 b05Fixed 7u201Fixed 8u181Fixed
Related Reports
Relates :  
Description
Touch keyboard does not hide even when the focus is lost from the editable text component

Reproducible on Microsoft Surface (Windows 10 Tablet Mode) 

Steps to reproduce:
Scenario 1:
1.Run the attached "JTouchTest2.java" or "TouchTest2.java" with JDK 8u172 b06
2.Touch on the editable area of one of the editable text components and wait for the touch keyboard to show
3.Touch on different component in application GUI

Scenario 2:
1.Run the attached "JTouchTest2.java" or "TouchTest2.java" with JDK 8u172 b06
2.Touch on the editable area of the text component with the text "text field" and wait for the touch keyboard to show
3.Press the Tab key on the touch keyboard, so that the focus shifts from the text field to one of the check boxes.

Expected behavior : on screen keyboard must get hidden once the focus is lost on the editable text component
Actual behavior : on screen keyboard does not get hidden when the focus is lost from the editable text component

Is it a regression: No, this is part of the new functionality introduced in 8u172 b01 as fix for JDK-8166772
Comments
Debugging showed that this issue was caused by a change of behavior of MS Windows 10 OS, which appeared in one of its updates. Particularly the window of the system touch keyboard currently does not have the style "WS_VISIBLE", even if it is really visible, in the latest update of MS Windows 10 OS, therefore this behavior change makes the function call "::IsWindowVisible(hwnd)", where "hwnd" is a handle of the touch keyboard window, to return "FALSE" always, what makes the method "AwtToolkit::GetTouchKeyboardWindow()" return "NULL", what finally prevents the method "AwtToolkit::HideTouchKeyboard()" from executing the code hiding the touch keboard.
12-03-2018

The original test cases attached by the bug filer to the bug record were edited: - to address thread-safety; - to make the shown frames closable so that they did not block the application from exiting; - to make them independent on the attached "PrintQL_Procedures.html" file. The new versions of the test cases are the attached files: "JTouchTest2.java", "TouchTest2.java".
08-03-2018

Hello Vikrant. Thank you for answering my questions. Now I am also able to reproduce the bug by following the scenario #2 and pressing "TAB" key on the touch keyboard with JDKs mentioned in my previous comment. But in the attached 2 test cases pressing "TAB" key leads to move of focus from a text component to another component in the application GUI only in case of text field components: "javax.swing.JTextField", "java.awt.TextField", in case of all other text components pressing "TAB" key leads to insertion of "TAB" character in a text of the text component. Therefore I am correcting "Scenario 2:" section in the description of the bug to reflect this detail.
28-02-2018

Hi Anton, 1) I agree with the expectation that the touch keyboard should be hidden when a touch/click leads to move of focus from the text component which currently has focus to another GUI component and I have updated the steps to reproduce to reflect the same. 2) We are able to reproduce this scenario using the TAB key on the touch keyboard, we did not use the physical keyboard for the TAB key in this scenario
27-02-2018

Hello Vikrant, Could you please answer the following 2 questions: 1) Regarding the described scenario #1 from the steps to reproduce the issue, I can observe that currently the touch keyboard is not hidden, when the focus moves from the text component to a different component in an application GUI, and it is a bug, although while working on the fix for JDK-8166772 that scenario was taken into account and verified in my local environment. But I do not agree with your expectation that the shown touch keyboard should be hidden on touch or on click on disabled components, because they cannot get focus, or on touch or click on just an empty or a non-editable area of the application window, because again this action will not lead to move of focus from the text component which currently has focus to another GUI component. I suppose that JDK should hide the shown touch keyboard, when the text component looses focus, will you agree with this expectation? If, yes, then I suggest to change the text in steps to reproduce to reflect this detail. 2) I cannot reproduce the scenario #2 using the test cases "JTouchTest.java", "TouchTest.java" on a PC with a touch screen, MS Windows 10 OS with JDK 10+44, JDK 10+29, JDK 8u172 b07, in my case pressing "TAB" key on a regular keyboard always leads to hiding of the touch keyboard, and as I understand the touch keyboard is hidden automatically by OS as soon as any key is pressed on a normal physical keyboard. Can you still reproduce the scenario #2 on your device? Thank you, Anton The scenario #1 from the description of the bug was reproduced on a PC with a touch screen and MS Windows 10 OS with JDK 10+44, JDK 10+29, JDK 8u172 b07. Starting analyzing the issue.
27-02-2018

Changed "relates to" link to refer to the main bug JDK-8166772 instead of its backport, which was previously referred through this link.
27-02-2018

Anton, can you please look at this request?
23-02-2018