When entering edit mode on a cell of an editable TableView, the TextField control added to the cell gains the focus, and the table loses it (expected).
If user presses ESCAPE, the edit mode gets cancelled, and the TableView regains the focus (expected).
However, if the user presses ENTER, the edit gets committed, and the TableView loses the focus (unexpected).
The following test reproduces the issue. The tableView has a green border if it is focused, red otherwise.
Steps:
- Start the test, the textField has the focus (tableView border red)
- Click on a cell of the second column. The row gets selected, tableView gets focused, border green.
- Click again to start editing the cell. The inner textField gains the focus, tableView loses it, border red (see edit cell.png)
- Press ESCAPE, tableView gains focus again, border green (see after ESC.png).
- Click again to start editing the cell. The inner textField gains the focus, tableView loses it, border red.
- Press ENTER, outer textField gains focus again and tableView loses it, border red (see after Enter.png).
If user presses ESCAPE, the edit mode gets cancelled, and the TableView regains the focus (expected).
However, if the user presses ENTER, the edit gets committed, and the TableView loses the focus (unexpected).
The following test reproduces the issue. The tableView has a green border if it is focused, red otherwise.
Steps:
- Start the test, the textField has the focus (tableView border red)
- Click on a cell of the second column. The row gets selected, tableView gets focused, border green.
- Click again to start editing the cell. The inner textField gains the focus, tableView loses it, border red (see edit cell.png)
- Press ESCAPE, tableView gains focus again, border green (see after ESC.png).
- Click again to start editing the cell. The inner textField gains the focus, tableView loses it, border red.
- Press ENTER, outer textField gains focus again and tableView loses it, border red (see after Enter.png).