JDK-8286831 : WebView can't switch to Chinese input method in GTK3
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx11,8u281,jfx17,jfx18,jfx19
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86_64
  • Submitted: 2022-05-11
  • Updated: 2024-12-07
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
tbdUnresolved
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Oracle Linux 8, Ubuntu 20.04 ,  Zulu  18.0.1.fx-zulu , 17.0.3.fx-zulu (OpenJDK + JavaFX)

A DESCRIPTION OF THE PROBLEM :
JavaFX Application include WebView, WebView Html Include TextArea,
(1) Web HTML Include HTML TextArea
By Default, I can not switch to Chinese Input method to input some chinese char。
But , I add start parameter -Djdk.gtk.version=2,
I can switch to Chinese Input method to input some chinese char。
But, I can not enter 'ENTER' to TextArea, even I switch to english input method IME.
(2) JavaFX Component TextArea
I test JavaFX Application include TextArea , after add start parameter -Djdk.gtk.version=2,
I can switch to Chinese Input method to input some chinese char。
And I can enter 'ENTER' to TextArea。

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java  JavaFXWebViewApp.jar

java -Djdk.gtk.version=2 -jar JavaFXWebViewApp.jar

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Can switch to Chinese Input method , and input chinese char , and input ENTER key
ACTUAL -
Can not switch to Chinese input method
or
Can Switch to Chinese input method and input Chinese Char, But can not input ENTER KET

---------- BEGIN SOURCE ----------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Collectors;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebViewExample extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage primaryStage) throws IOException {
String content="";
String path="index.html";
BufferedReader br = new BufferedReader(new InputStreamReader(WebViewExample.class.getResourceAsStream(path)));
content =  br.lines().collect(Collectors.joining());
     
       primaryStage.setTitle("JavaFX WebView Example");

        WebView webView = new WebView();
        WebEngine webEngine  =  null;
        webEngine  = webView.getEngine();
        webEngine.load("http://google.com");
        
       // String content = "Hello World!";
        webEngine.loadContent(content, "text/html");
        VBox vBox = new VBox(webView);
        Scene scene = new Scene(vBox, 960, 600);

        primaryStage.setScene(scene);
        primaryStage.show();

    }
}
---index.html--------------
<!DOCTYPE html>
<html lang="zh-hant" >
<head>
<meta charset="utf-8">
<title>Test JavaFX WebView TextArea</title>
</head> 
<body>
<textarea name="mytext"
          rows="6"
          cols="40"
          required>
Please input chinese char and press enter key
</textarea>
</body> 
</html>


---------- END SOURCE ----------


Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1660 Date: 2024-12-07 03:10:28 +0000
07-12-2024

Given that it reproduces with GTK3 and not with GTK2, this is a window-toolkit (glass) bug. Changing the category accordingly. We need to see whether reproduces without WebView.
17-05-2022

Checked with attached testcase in ubuntu 20.05, issue is reproducible, Using Chinese Intelligent Pinyin input method, character(candidate box) doesn't appears, in GTK 3 $gtk-launch --version 3.24.20 Using -Djdk.gtk.version=2, character(candidate box) appears Test Result ======= 8:Pass 8u281: Fail openjfx11: Fail openjfx17: Fail openjfx18: Fail openjfx19ea6: Fail
16-05-2022