Optimizing keyboard navigation and selection handling

This commit is contained in:
2026-03-21 18:08:13 +01:00
parent 853bc4abae
commit f887267362
5 changed files with 82 additions and 25 deletions

View File

@@ -281,14 +281,14 @@ class TestDataGridBehaviour:
# Selection and Interaction
# ------------------------------------------------------------------
def test_i_can_on_key_pressed_esc_clears_selection(self, datagrid):
def test_i_can_on_key_pressed_esc_clears_selection(self, datagrid_with_data):
"""Test that pressing ESC resets both the focused cell and extra selections.
ESC is the standard 'deselect all' shortcut. Both selected and
extra_selected must be cleared so the grid visually deselects everything
and subsequent navigation starts from a clean state.
"""
dg = datagrid
dg = datagrid_with_data
dg._state.selection.selected = (1, 2)
dg._state.selection.extra_selected.append(("range", (0, 0, 2, 2)))