Skip to content

Commit

Permalink
fix anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 26, 2024
1 parent 6f1f753 commit 4b79e88
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def opacity(self) -> float:
@property
def is_anchored(self) -> bool:
"""Is this widget anchored?"""
return self._parent is not None and self._parent is self
return isinstance(self._parent, Widget) and self._parent._anchored is self

@property
def is_mouse_over(self) -> bool:
Expand Down Expand Up @@ -4080,9 +4080,7 @@ async def _on_idle(self, event: events.Idle) -> None:
self._check_refresh()

if self.is_anchored:
self.scroll_visible(animate=self._anchor_animate)
if self._anchored:
self._anchored.scroll_visible(animate=self._anchor_animate)
self.scroll_visible(animate=self._anchor_animate, immediate=True)

def _check_refresh(self) -> None:
"""Check if a refresh was requested."""
Expand Down

0 comments on commit 4b79e88

Please sign in to comment.