On Wed, 11 Oct 2023 17:56:15 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>>> > The `focusWithin` count cannot be negative, and there is no possible way 
>>> > for applications to misuse the API to cause a negative count. If it ends 
>>> > up being negative, that's because of a bug, and I think that bugs should 
>>> > be fixed and not logged.
>>> 
>>> Yes, the reason I was asking this is that we actually have this problem 
>>> right now, that it could be negative, although it should not. If we would 
>>> have logged that, we probably found that bug much earlier. In any case, I 
>>> think with the new logic and the `count > 0`, it is fine as is.
>> 
>> @Maran23  Just to clarify...
>> If I have a case (with jfx21) where the count goes negative, is this still a 
>> bug that I should file?  Or are you saying that it's understood as expected 
>> behavior now?
>
>> > > The `focusWithin` count cannot be negative, and there is no possible way 
>> > > for applications to misuse the API to cause a negative count. If it ends 
>> > > up being negative, that's because of a bug, and I think that bugs should 
>> > > be fixed and not logged.
>> > 
>> > 
>> > Yes, the reason I was asking this is that we actually have this problem 
>> > right now, that it could be negative, although it should not. If we would 
>> > have logged that, we probably found that bug much earlier. In any case, I 
>> > think with the new logic and the `count > 0`, it is fine as is.
>> 
>> @Maran23 Just to clarify... If I have a case (with jfx21) where the count 
>> goes negative, is this still a bug that I should file? Or are you saying 
>> that it's understood as expected behavior now?
> 
> If you have a situation where the focusWithin count is negative, please file 
> it as a bug. That's not expected behavior.

> @mstr2 or @Maran23 Does "focus owner" == "input focus" == "scene focus owner" 
> == where key events will be sent?

This is true in general. Note that an unfocused window will not receive input 
events, but the scene can have a focus owner nonetheless.

> I ask because the javadoc on Node.focusWithin says "Indicates whether this 
> Node or any of its descendants currently has the **_input focus_**.", but in 
> discussions it has been said that focusWithin includes a TableView's "focused 
> item" even if that is not the scene's current focus owner (i.e. where key 
> events will be sent).
> 
> It would be great if the javadoc for Node.focusWithin could be improved to 
> avoid this kind of widespread confusion about what it really means.

Yes, the documentation is misleading. We should at the very least fix that.

By the way, there's an ongoing discussion on the OpenJFX mailing list: 
https://mail.openjdk.org/pipermail/openjfx-dev/2023-October/042864.html

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

PR Comment: https://git.openjdk.org/jfx/pull/1210#issuecomment-1758473325

Reply via email to