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

Mirco mirchord at gmail.com
Sat Apr 14 16:45:44 UTC 2018

please forgive me if this is not the appropriate place for such kind of
I've encountered what seems a regression from jfx8, at least on "Ubuntu
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
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

Kind regards,


More information about the openjfx-dev mailing list