Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8095710

Focus change on TableView scroll

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 8u5
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Environment:

      Windows 7 JDK8 b129

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              pkeckjfx Philipp Keck (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: