Skip to content

Fix: FontComboBox closes unexpectedly#6238

Open
KSSJW wants to merge 3 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:font-combo-box
Open

Fix: FontComboBox closes unexpectedly#6238
KSSJW wants to merge 3 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:font-combo-box

Conversation

@KSSJW

@KSSJW KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

修复FontComboBox在预期外关闭的问题

问题

  • 拖动滑条后会关闭Pop
  • 单击滑条也会关闭Pop

更改

  • 关闭条件限制为:选择列表项、点击列表外

实况

更改前

1.mp4

更改后

2.mp4

@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@3gf8jv4dv 3gf8jv4dv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非常好 PR,虽然 HMCL 的字体一言难尽

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates FontComboBox.java to manually handle hiding the popup when an item is clicked, by listening to skin changes and adding a mouse click listener to the underlying ListView. The review feedback correctly identifies a bug where clicking on child nodes (like text) inside a ListCell will prevent the popup from closing, and provides a robust solution to traverse the parent hierarchy to find the clicked cell.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java Outdated
@KSSJW

KSSJW commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates FontComboBox.java to customize the behavior of its skin. Specifically, it adds a listener to skinProperty() to disable hideOnClick on ComboBoxListViewSkin and manually handle hiding the combo box when a non-empty list cell is clicked. The reviewer provided valuable feedback to improve robustness: using pattern matching with instanceof to safely cast the popup content and avoid potential exceptions, and using addEventHandler instead of setOnMouseClicked to prevent overwriting existing event handlers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java Outdated
@KSSJW KSSJW marked this pull request as ready for review June 27, 2026 14:07

@3gf8jv4dv 3gf8jv4dv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏄

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