fix: Search bar immediately clears search params and returns server contents after ESCAPE key-press

This commit is contained in:
Zhongheng Liu 2026-01-22 21:04:28 +01:00
commit 7cddc0303c
Signed by: steven
GPG key ID: F69B980899C1C09D

View file

@ -10,6 +10,7 @@ import javafx.animation.PauseTransition;
import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.util.Duration;
import java.io.IOException;
@ -146,6 +147,11 @@ public class SearchBarCtrl implements LocaleAware {
});
this.searchField.setOnKeyReleased(event -> {
if (event.getCode() == KeyCode.ESCAPE) {
searchField.clear();
this.onSearch();
return;
}
// This cancels the current debounce timer and restarts it.
this.searchDebounce.playFromStart();
});