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

Clicking a selected cell from a group of selected cells in a TableView clears the selected items list but remains selected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx19
    • jfx11.0.2, jfx17
    • javafx
    • None

        Given a TableView with multiple selection mode and cell selection enabled, after selecting some cells (with shift), and deselecting them by clicking on one of the selected cells, this last cell remains selected (the cell keeps the selected pseudoclass state), but the list of selected items is empty.

        Also, if a ListChangeListener is added to such list, the Change.removed list contains a null element, instead of the first element of the list.

        This can be reproduced with any JavaFX version from 11 to head (though JDK-8273324 is found after 17-ea+14).

        Attached is a test that can be used to reproduce the issue, with any version lower than 17-ea+14 (to avoid JDK-8273324).

        Steps:
        1. Select the first cell in the first row by mouse clicking on it. Log:
        Change: { [Person{a b}] added at 0 }, selected items: [Person{a b}]

        2. Press Shift and mouse click the other cell in the same row. Log:
        Change: { [Person{a b}] removed at 0 }, selected items: []
        Change: { [Person{a b}] added at 0 }, selected items: [Person{a b}]

        3. Release Shift, and mouse click on one of the already-selected cells. Log:
        Change: { [null] removed at 1 }, selected items: []

        Same with these steps:

         1. Select the first cell "a" in the first row by mouse clicking on it. Log:
        Change: { [Person{a b}] added at 0 }, selected items: [Person{a b}]

        2. Press Shift and mouse click the cell "d" in the second row. Log:
        Change: { [Person{a b}] removed at 0 }, selected items: []
        Change: { [Person{a b}, Person{c d}] added at 0 }, selected items: [Person{a b}, Person{c d}]

        3. Release Shift, and mouse click either on the selected cell "a", log:
        Change: { [Person{c d}, null] removed at 1 }, selected items: []

        or "c", log:
        Change: { [Person{c d}, null] removed at 1 }, selected items: []

        In any case, the null element of the removed change list seems to be corresponding to the first item (person {a,b}).

        If the selected items list is empty, the selected pseudoclass should be removed from the cell. It is possible that the null element is preventing this.

              jpereda Jose Pereda
              jpereda Jose Pereda
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: