WebView: in jfx9 the ENTER key from keyboard does not add new lines on textareas (but works correctly on jfx8)

Murali Billa murali.billa at oracle.com
Sat Apr 14 17:22:24 UTC 2018

Hi Mirco,

I tried the below sample code with JDK9+180 in Ubuntu and able to reproduce this issue.

I tried with latest JDK build in Ubuntu (and in windows too) and not able to reproduce this issue (i can see new lines are being added upon entering ENTER key)

I suggest you can verify  with latest JDK build.


-----Original Message-----
From: Mirco <mirchord at gmail.com> 
Sent: Saturday, April 14, 2018 10:16 PM
To: openjfx-dev at openjdk.java.net
Subject: WebView: in jfx9 the ENTER key from keyboard does not add new lines on textareas (but works correctly on jfx8)

please forgive me if this is not the appropriate place for such kind of reports.
I've encountered what seems a regression from jfx8, at least on "Ubuntu 16.04".
As stated in the mail object the ENTER key produces no effects inside any editable components of a webpage.
Note: the CTRL-M works instead.

What follows is a very simple example to illustrate the issue:

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

public class WebViewSample extends Application {
    private Scene scene;

    @Override public void start(Stage stage) {
        stage.setTitle("Web View");
WebView editor = new WebView();
WebEngine engine = editor.getEngine();
engine.loadContent("<textarea rows=25 cols=25>Type content here...</textarea>"); editor.setContextMenuEnabled(false);
editor.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent evt) -> { System.out.println(evt.getCode()); });
        VBox root = new VBox();
        scene = new Scene(root,750,500);

    public static void main(String[] args){
        launch(WebViewSample.class, args);

As you can see the ENTER event is intercepted and printed out by the filter but no newline is added.
This problem should not be confused with an old bug related to the JFXPanel (here no swing is involved).
I have not tried with the latest builds of openjfx so just in case you are aware of that and/or the problem is already resolved please ignore this email.

Kind regards,


More information about the openjfx-dev mailing list