RFR: 8320912: IME should commit on focus change

yosbits duke at openjdk.org
Mon Apr 29 14:11:12 UTC 2024


On Tue, 30 Jan 2024 20:32:36 GMT, Martin Fox <mfox at openjdk.org> wrote:

> This is a Mac only bug. If the user was in the middle of IM text composition and clicked on a different node the partially composed text was left in the old node and the IM window wasn't dismissed. This PR implements the existing finishInputMethodComposition call so it can commit the text and dismiss the IM window before focus moves away from the node where composition was taking place.
> 
> This PR changes the implementation of `unmarkText` to match what we want and what Apple says it should do ("The text view should accept the marked text as if it had been inserted normally"). With that said I haven't found an IME that calls this routine.

**I found a serious problem with this change.**

After applying this change, the IME cannot be typed after the small window is displayed.
Even basic applications that use ContextMenu, ChoiceBox, ComboBox, MenuButton, etc. are affected.
The impact of this problem will be perceived as block level in the IME usage environment.

This problem is no longer reproduced by reverting the changes in JDK-8320912.
However, since JDK-8301900 depends on the changes in JDK-8320912, 8301900 was also reverted.

This problem can be reproduced with the following application

``` Java
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class ImeTest extends Application{

	enum Items {
		A,
		B,
		C
	}
	
	@Override
	public void start(Stage primaryStage) throws Exception {
		ChoiceBox<Items> choiceBox = new ChoiceBox<>();
		ComboBox<Items> comboBox = new ComboBox<>();
		MenuButton menuButton = new MenuButton();
		
		menuButton.getItems().addAll(new MenuItem("1"), new MenuItem("2"));
		choiceBox.getItems().addAll(Items.values());
		comboBox.getItems().addAll(Items.values());
		
		VBox root = new VBox(
			new Label("1. Select any of the following control items."),
			new HBox( 8, choiceBox, comboBox, menuButton),
			new Label("2. Entering text with the IME."),
			new HBox(8, new TextField(), new TextArea()));
		
		Scene scene = new Scene(root, 600, 600);
		primaryStage.setScene(scene);
		primaryStage.show();
		
	}
	
	public static void main(String[] args) {
		Application.launch(args);
	}
}

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

PR Comment: https://git.openjdk.org/jfx/pull/1356#issuecomment-2082858747


More information about the openjfx-dev mailing list