On Wed, 11 Mar 2026 01:00:33 GMT, Ziad El Midaoui <[email protected]> wrote:
>> The bug occurs when `showRoot` is set to false on a root with no children, >> the expanded item count drops is 0 causing `isFocused(0)` to return false >> even though `focusedIndex` is still 0. When items are added afterwards the >> `treeItemListener` sees `focusedIndex=0` and incorrectly shifts it to 1 >> placing the focus on second item of the TreeView. >> The fix replaces `isFocused(0)` with `getFocusedIndex() >= 0`, which reads >> the raw stored index. > > Ziad El Midaoui has updated the pull request incrementally with one > additional commit since the last revision: > > minor changes > The reproducer does FAIL without the fix and and does not show any marker > with fix. > > 1. Without Fix : focus rect is drawn on second item. > 2. With Fix : No focus rect is drawn, nor any item is selected. Thank you for clarification, yes the solution provided does not select any item so that is expected. I will look into it and fix the test. ------------- PR Comment: https://git.openjdk.org/jfx/pull/2095#issuecomment-4039708952
