RFR: 8313956: focusWithin on parents of a newly-added focused node is not updated [v2]
John Hendrikx
jhendrikx at openjdk.org
Fri Aug 18 09:22:36 UTC 2023
On Fri, 18 Aug 2023 09:16:57 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 8201:
>>
>>> 8199:
>>> 8200: // Since focus changes are atomic, we only fire change notifications after
>>> 8201: // all changes are committed on all old and new parents.
>>
>> Is it possible a user can interfere with this process by adding a listener to `focusWithinProperty`? It fires events when it goes from `true` to `false` and vice versa.
>
> I also noticed this code, which I think will not do the correct thing when `change` is not 1 or -1:
>
> void adjust(int change) {
> count += change;
>
> if (count == 1) {
> set(true);
> } else if (count == 0) {
> set(false);
> }
> }
>
> For example, if focus within currently is `false`, and it is "adjusted" by 5, the count goes from 0 to 5 in one go. It will remain `false` then. Is this intended?
> Is it possible a user can interfere with this process by adding a listener to `focusWithinProperty`? It fires events when it goes from `true` to `false` and vice versa.
Can disregard this, it seems the property uses a special base class that breaks with the general property contract.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1210#discussion_r1298220463
More information about the openjfx-dev
mailing list