fix: Search bar immediately clears search params and returns server contents after ESCAPE key-press
This commit is contained in:
parent
4c341aadec
commit
7cddc0303c
1 changed files with 6 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import javafx.animation.PauseTransition;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -146,6 +147,11 @@ public class SearchBarCtrl implements LocaleAware {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.searchField.setOnKeyReleased(event -> {
|
this.searchField.setOnKeyReleased(event -> {
|
||||||
|
if (event.getCode() == KeyCode.ESCAPE) {
|
||||||
|
searchField.clear();
|
||||||
|
this.onSearch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// This cancels the current debounce timer and restarts it.
|
// This cancels the current debounce timer and restarts it.
|
||||||
this.searchDebounce.playFromStart();
|
this.searchDebounce.playFromStart();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue