diff --git a/src/textual/css/_style_properties.py b/src/textual/css/_style_properties.py index bc16b60fac..c66068d280 100644 --- a/src/textual/css/_style_properties.py +++ b/src/textual/css/_style_properties.py @@ -956,13 +956,16 @@ def __set__(self, obj: StylesBase, color: Color | str | None) -> None: if obj.node is None: return - widget = cast("Widget", obj.node) + from ..widget import Widget - if widget.show_horizontal_scrollbar: - widget.horizontal_scrollbar.refresh() + if isinstance(obj.node, Widget): + widget = obj.node + + if widget.show_horizontal_scrollbar: + widget.horizontal_scrollbar.refresh() - if widget.show_vertical_scrollbar: - widget.vertical_scrollbar.refresh() + if widget.show_vertical_scrollbar: + widget.vertical_scrollbar.refresh() class StyleFlagsProperty: