diff --git a/src/textual/widgets/_data_table.py b/src/textual/widgets/_data_table.py
index 170d1594e..282161557 100644
--- a/src/textual/widgets/_data_table.py
+++ b/src/textual/widgets/_data_table.py
@@ -196,7 +196,9 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
show_cursor = Reactive(True)
cursor_type = Reactive(CELL)
- cursor_cell: Reactive[Coord] = Reactive(Coord(0, 0), repaint=False)
+ cursor_cell: Reactive[Coord] = Reactive(
+ Coord(0, 0), repaint=False, always_update=True
+ )
hover_cell: Reactive[Coord] = Reactive(Coord(0, 0), repaint=False)
def __init__(
@@ -460,7 +462,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
# TODO - I want to set this here, but that will trigger the validator
# again which is pointless - since I know the value is valid...
# Don't think we have a means of doing this yet.
- self.cursor_cell = self._clamp_cursor_cell(self.cursor_cell)
+ self.cursor_cell = self.cursor_cell
self.check_idle()
def add_rows(self, rows: Iterable[Iterable[CellType]]) -> None:
@@ -832,7 +834,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
meta = self.get_style_at(event.x, event.y).meta
if meta:
self.cursor_cell = Coord(meta["row"], meta["column"])
- self._scroll_cursor_into_view()
+ self._scroll_cursor_into_view(animate=True)
event.stop()
def key_down(self, event: events.Key):
diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
index 4a9464a81..d38ae1271 100644
--- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
+++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr
@@ -4621,134 +4621,133 @@
font-weight: 700;
}
- .terminal-133545376-matrix {
+ .terminal-121683423-matrix {
font-family: Fira Code, monospace;
font-size: 20px;
line-height: 24.4px;
font-variant-east-asian: full-width;
}
- .terminal-133545376-title {
+ .terminal-121683423-title {
font-size: 18px;
font-weight: bold;
font-family: arial;
}
- .terminal-133545376-r1 { fill: #dde6ed;font-weight: bold }
- .terminal-133545376-r2 { fill: #e1e1e1 }
- .terminal-133545376-r3 { fill: #c5c8c6 }
- .terminal-133545376-r4 { fill: #e7e5e2 }
- .terminal-133545376-r5 { fill: #211505 }
+ .terminal-121683423-r1 { fill: #dde6ed;font-weight: bold }
+ .terminal-121683423-r2 { fill: #e1e1e1 }
+ .terminal-121683423-r3 { fill: #c5c8c6 }
+ .terminal-121683423-r4 { fill: #211505 }
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
- TableApp
+ TableApp
-
-
-
- lane swimmer country time
- 4 Joseph Schooling Singapore 50.39
- 2 Michael Phelps United States 51.14
- 5 Chad le Clos South Africa 51.14
- 6 László Cseh Hungary 51.14
- 3 Li Zhuhao China 51.26
- 8 Mehdy Metella France 51.58
- 7 Tom Shields United States 51.73
- 1 Aleksandr Sadovnikov Russia 51.84
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ lane swimmer country time
+ 4 Joseph Schooling Singapore 50.39
+ 2 Michael Phelps United States 51.14
+ 5 Chad le Clos South Africa 51.14
+ 6 László Cseh Hungary 51.14
+ 3 Li Zhuhao China 51.26
+ 8 Mehdy Metella France 51.58
+ 7 Tom Shields United States 51.73
+ 1 Aleksandr Sadovnikov Russia 51.84
+
+
+
+
+
+
+
+
+
+
+
+
+
+