I have a TableView that contains focusable nodes (even when not in edit mode). There is a separate ticket for adding explicit support for that. The problem might as well occur with cells in edit mode:
When scrolling away a focused cell, it is hidden by the TableView (VirtualFlow.cleanPile()). This causes Scene.focusIneligible() to be called, which assigns the focus to some other (seemingly random) node. When there are plenty of focusable nodes in the TableView (as in my case), the focus jumps around weirdly, which confuses users because they did nothing but scroll, and when they scroll back, they expect the focus to be where it was because that is how they remember where they were working.
This looks like a minor issue, but it causes great confusion.
Possible fix: Before hiding a cell in VirtualFlow.cleanPile(), check if it contains the focus (i.e. if it or one or its children is focused) and if so, call requestFocus() on the entire outer control that the VirtualFlow belongs to. Focusing the TableView (in that case) works fine and nicely highlights the previously focused line as selected.
When scrolling away a focused cell, it is hidden by the TableView (VirtualFlow.cleanPile()). This causes Scene.focusIneligible() to be called, which assigns the focus to some other (seemingly random) node. When there are plenty of focusable nodes in the TableView (as in my case), the focus jumps around weirdly, which confuses users because they did nothing but scroll, and when they scroll back, they expect the focus to be where it was because that is how they remember where they were working.
This looks like a minor issue, but it causes great confusion.
Possible fix: Before hiding a cell in VirtualFlow.cleanPile(), check if it contains the focus (i.e. if it or one or its children is focused) and if so, call requestFocus() on the entire outer control that the VirtualFlow belongs to. Focusing the TableView (in that case) works fine and nicely highlights the previously focused line as selected.