Hi Michael, Thank you for the explanation. I was confused to see focused still set to true on cells, which is more prominent now with the introduction of `focusWithin`.
Deprecating `Note.setFocused` would need a major update across controls, whereas an update in Cell to use cell-specific focus property seems harmless. - Abhinay > On 22 Nov 2024, at 4:19 PM, Michael Strauß <michaelstr...@gmail.com> wrote: > > This was an unfortunate decision. The reason for this seems to be that > cell-based controls use the `focused` property in a non-standard way, > to remember the focused cell even when the input focus was moved to a > different control. There's no reason to do that, and can be fixed by > introducing a cell-specific property for this purpose (maybe > "retainedFocus", "cellFocus", or something like that). Controls should > never tamper with focus properties, as these are managed by the Node > class. We should probably deprecate the `Node.setFocused` method that > currently allows derived classes to change the focused property. > > > On Fri, Nov 22, 2024 at 11:20 AM Abhinay Agarwal > <abhinay_agar...@live.com> wrote: >> >> Hi, >> >> Controls like ListView, TreeView, etc. always have one of the cells with >> focused property set to true. >> >> This causes the focusWithin property [1] (introduced in 19) on these >> controls to be set to true even when the actual focus is neither on them nor >> its children. >> >> I wonder if there is a reason for setting the focused property on one the >> cells always to true? >> >> - Abhinay >> >> [1] >> https://openjfx.io/javadoc/23/javafx.graphics/javafx/scene/Node.html#focusWithinProperty