RFR: 8313956: focusWithin on parents of a newly-added focused node is not updated [v4]

Andy Goryachev angorya at openjdk.org
Fri Aug 18 22:05:34 UTC 2023


On Fri, 18 Aug 2023 21:48:59 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> thank you for explanations!
>> 
>> one more question: suppose, prior to removal of the Pane it contained a focused (Scene.focusOwner) Node.
>> 1. once the Pane is removed, what happens to Scene.focusOwner?
>> 2. once the Pane is added back, would we have an inconsistent state in respect to Scene.focusOwner (if some other node requested focus in the mean time, wouldn't we have two focused nodes?)
>
>> thank you for explanations!
>> 
>> one more question: suppose, prior to removal of the Pane it contained a focused (Scene.focusOwner) Node.
>> 
>> 1. once the Pane is removed, what happens to Scene.focusOwner?
> 
> There's quite a bit of logic happening. `Scene.focusCleanup()` is a good starting point. Basically, we need to find a new focus owner if the old focus owner is removed from the scene graph.
> 
>> 2. once the Pane is added back, would we have an inconsistent state in respect to Scene.focusOwner (if some other node requested focus in the mean time, wouldn't we have two focused nodes?)
> 
> It's not inconsistent, but it wouldn't be the same state as before. The `focused` state would remain, but `Scene.focusOwner` would not be restored to the previous node. That part of the focus story hasn't changed with the introduction of `focus-visible` and `focus-within`.

So, in the scenario # 2, we would arrive at situation when the previously focused Node is still decorated as having the focus, but won't be getting the events since Scene.focusOwner is different?  I suppose it's the way the whole thing is designed to work.
Thank you for the explanations!

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1210#discussion_r1298892884


More information about the openjfx-dev mailing list