Skip to content

Conversation

@CiiLu
Copy link
Contributor

@CiiLu CiiLu commented Jan 24, 2026

No description provided.

Copy link
Contributor

Copilot AI left a 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 JFXListView instances created by ToolbarListPageSkin.

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);
Copy link

Copilot AI Jan 24, 2026

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).

Copilot uses AI. Check for mistakes.
Comment on lines 64 to 66
this.listView.setPadding(Insets.EMPTY);
this.listView.setFocusTraversable(false);
this.listView.setCellFactory(listView -> createListCell((JFXListView<E>) listView));
Copy link

Copilot AI Jan 24, 2026

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.

Copilot uses AI. Check for mistakes.
@Glavo
Copy link
Member

Glavo commented Jan 27, 2026

这样改是不是会进一步破坏用键盘控制时的体验?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants