> This PR fixes the issue that after committing an edit on a > ListView/TreeView/TableView/TreeTableView control, the control might lose the > focus unexpectedly. > > For that, it refactors the > `ControlUtils::requestFocusOnControlOnlyIfCurrentFocusOwnerIsChild` method, > in order to check if the control (`ListView`, `TreeView`, `TableView`, > `TreeTableView`) should request the focus _before_ the actual focus owner > (which could be the control added to the cell to edit its content, like a > `TextField`) is removed from the cell, so the `Control::requestFocus` call, > if needed, can be still invoked after the edit commit is done (as it was done > before). > > By adding `ControlUtils::controlShouldRequestFocusIfCurrentFocusOwnerIsChild` > the `Cell::commitEdit` implementations can now query if the control should > have the focus, after `super.commitEdit(newValue);` but before firing the > `CellEditEvent` and calling `updateItem()`, and if the result is true, then > request focus after the edit commit ends (like it was done before). > > Two new tests per control have been included, to verify that the focus > remains at the control, one for edit cancel (this passes before and after the > proposed changes), one for edit commit (this fails before and passes after > including the proposed fix).
Jose Pereda has updated the pull request incrementally with one additional commit since the last revision: Address feedback from reviewer ------------- Changes: - all: https://git.openjdk.org/jfx/pull/1411/files - new: https://git.openjdk.org/jfx/pull/1411/files/8f312781..744562f0 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=1411&range=01 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1411&range=00-01 Stats: 16 lines in 4 files changed: 0 ins; 16 del; 0 mod Patch: https://git.openjdk.org/jfx/pull/1411.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1411/head:pull/1411 PR: https://git.openjdk.org/jfx/pull/1411