On Thu, 17 Jul 2025 05:18:28 GMT, Michael Strauß <[email protected]> wrote:

>> Implementation of [focus 
>> delegation](https://gist.github.com/mstr2/44d94f0bd5b5c030e26a47103063aa29).
>
> Michael Strauß has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Avoid variable reassignment

After I did a deep check on the focus/focus traversable implementation and 
usage, I think something like this is 100% needed. 

I just wonder if we can achieve this a bit easier/simple.

Especially `ScrollBar` and Table related `Controls` had interesting 
implementations to 'trap' the focus.

An easy improvement would be that every `Node` can have a proxy where the focus 
should be requested (instead). `ScrollBar` needs it set for whatever `Control` 
it should scroll in. The Table Column Header needs that, the `VirtualFlow` as 
well, rows and cells as well. But I'm not even 100% sure about the idea. We 
probably need to check every case and find the usecase. I did not checked the 
`FakeFocusTextField` and related yet.

The Idea that a `Control` is the top level node that receives focus and 
everything else is a black box sounds interesting. But there are controls that 
do not request focus at all, like the `Accordion`. There, only the `TitledPane` 
will.

Or a complete different approach: We retrofit the `focusWithin` in those 
controls. As far as I could see, the goal was always to have the focus rect 
when pressing an inner `Control`. Well, this property is exactly there for 
this. And the focus request hacks can be removed. 

Needs more research.

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

PR Comment: https://git.openjdk.org/jfx/pull/1632#issuecomment-4056165702

Reply via email to