-
Notifications
You must be signed in to change notification settings - Fork 819
Fix #5307 #5037 : 列表点击后无法 esc 返回 #5311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Fixes issues where, after clicking into certain list views, pressing Esc no longer triggers the global “back” navigation handler.
Changes:
- Disables focus traversal on the resourcepack list
JFXListView. - Disables focus traversal on all
JFXListViewinstances created byToolbarListPageSkin.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcepackListPage.java |
Prevents the resourcepack list from becoming focus-traversable to avoid consuming Esc/back. |
HMCL/src/main/java/org/jackhuang/hmcl/ui/ToolbarListPageSkin.java |
Applies the same focus-traversable change to all list pages using the shared skin. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| center.getStyleClass().add("large-spinner-pane"); | ||
| center.loadingProperty().bind(control.loadingProperty()); | ||
|
|
||
| listView.setFocusTraversable(false); |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting the ListView to non-focus-traversable is a very broad fix for the ESC/back issue and can regress keyboard interaction (arrow-key navigation, type-to-select, accessibility focus). In other list pages (e.g., versions/ModListPageSkin.java and versions/DatapackListPageSkin.java) the pattern is to bypass ListViewBehavior only for ESC via FXUtils.ignoreEvent(listView, KeyEvent.KEY_PRESSED, e -> e.getCode() == KeyCode.ESCAPE) so ESC can reach the global handler without disabling focus entirely. Consider switching to that approach here instead of setFocusTraversable(false).
| this.listView.setPadding(Insets.EMPTY); | ||
| this.listView.setFocusTraversable(false); | ||
| this.listView.setCellFactory(listView -> createListCell((JFXListView<E>) listView)); |
Copilot
AI
Jan 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listView.setFocusTraversable(false) changes focus behavior for every page using ToolbarListPageSkin (Java management, installer list, world list, etc.) and can break keyboard navigation/selection in these lists. The underlying ESC/back problem is typically handled more narrowly by letting ESC bypass the ListView dispatcher (see FXUtils.ignoreEvent(...) usage in versions/ModListPageSkin.java / versions/DatapackListPageSkin.java). Consider replacing this with an ESC-specific FXUtils.ignoreEvent(listView, KeyEvent.KEY_PRESSED, e -> e.getCode() == KeyCode.ESCAPE) so ESC reaches DecoratorController’s global handler while preserving normal focus/keyboard behavior.
No description provided.