Text field fixes

This commit is contained in:
crschnick 2024-08-23 19:30:56 +00:00
parent be684d7b72
commit 3ca8db6ed4
3 changed files with 6 additions and 17 deletions

View file

@ -618,7 +618,10 @@ public final class BrowserFileListComp extends SimpleComp {
editing.addListener((observable, oldValue, newValue) -> {
if (getTableRow().getItem() != null && getTableRow().getItem().equals(newValue)) {
PlatformThread.runLaterIfNeeded(() -> textField.requestFocus());
PlatformThread.runLaterIfNeeded(() -> {
textField.setDisable(false);
textField.requestFocus();
});
}
});

View file

@ -45,6 +45,7 @@ public class LazyTextFieldComp extends Comp<CompStructure<TextField>> {
r.focusedProperty().addListener((c, o, n) -> {
if (!n) {
appliedValue.setValue(currentValue.getValue());
r.setDisable(true);
}
});
@ -71,11 +72,6 @@ public class LazyTextFieldComp extends Comp<CompStructure<TextField>> {
currentValue.setValue(newValue);
});
r.focusedProperty().addListener((c, o, n) -> {
if (!n) {
r.setDisable(true);
}
});
r.getStyleClass().add("lazy-text-field-comp");
return new SimpleCompStructure<>(r);
}

View file

@ -213,23 +213,13 @@ public class AppWindowHelper {
InputHelper.onNavigationInput(scene, (kb) -> {
var r = scene.getRoot();
if (r != null) {
var acc = Platform.isAccessibilityActive();
// This property is broken on some systems
var acc = Platform.isAccessibilityActive();
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("key-navigation"), kb);
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("normal-navigation"), !kb);
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("accessibility-navigation"), acc);
}
});
Platform.accessibilityActiveProperty().addListener((observable, oldValue, newValue) -> {
var r = scene.getRoot();
if (r != null) {
// This property is broken on some systems
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("key-navigation"), true);
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("normal-navigation"), false);
r.pseudoClassStateChanged(PseudoClass.getPseudoClass("accessibility-navigation"), true);
}
});
}
public static void setupContent(