[jfx20] RFR: 8300013: Node.focusWithin doesn't account for nested focused nodes [v2]

Michael Strauß mstrauss at openjdk.org
Fri Jan 13 04:04:54 UTC 2023


> When a scene graph contains multiple nested focused nodes (this can happen with `TableView` and other controls), the `focusWithin` bits that are cleared when a focused node is de-focused must only be cleared when there is no other nested node in the scene graph that would also cause `focusWithin` to be set.
> 
> For example, consider a scene graph of nested nodes:
> A -> B -> C -> D
> 
> When B and D are both focused, the scene graph looks like this:
> A(`focusWithin`)
> -> B(`focused`, `focusWithin`)
> -> C(`focusWithin`)
> -> D(`focused`, `focusWithin`)
> 
> When B is de-focused, the `focusWithin` flags must still be preserved because D remains focused.
> 
> This PR fixes the issue by counting the number of times `focusWithin` has been "set", and only clears it when it has been "un-set" an equal number of times.

Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:

  refactoring

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

Changes:
  - all: https://git.openjdk.org/jfx/pull/993/files
  - new: https://git.openjdk.org/jfx/pull/993/files/96661623..1508cdbf

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=993&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=993&range=00-01

  Stats: 39 lines in 2 files changed: 20 ins; 0 del; 19 mod
  Patch: https://git.openjdk.org/jfx/pull/993.diff
  Fetch: git fetch https://git.openjdk.org/jfx pull/993/head:pull/993

PR: https://git.openjdk.org/jfx/pull/993


More information about the openjfx-dev mailing list