On Fri, 18 Aug 2023 09:16:57 GMT, John Hendrikx <jhendr...@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