Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't scroll to docked widgets #1851

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Removed `screen.visible_widgets` and `screen.widgets`


### Fixed

- Numbers in a descendant-combined selector no longer cause an error https://github.com/Textualize/textual/issues/1836

- Fixed superfluous scrolling when focusing a docked widget https://github.com/Textualize/textual/issues/1816

## [0.11.1] - 2023-02-17

Expand Down
30 changes: 17 additions & 13 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
from ._animator import DEFAULT_EASING, Animatable, BoundAnimator, EasingFunction
from ._arrange import DockArrangeResult, arrange
from ._asyncio import create_task
from ._compose import compose
from ._cache import FIFOCache
from ._compose import compose
from ._context import active_app
from ._easing import DEFAULT_SCROLL_EASING
from ._layout import Layout
Expand Down Expand Up @@ -1891,18 +1891,22 @@ def scroll_to_widget(

while isinstance(widget.parent, Widget) and widget is not self:
container = widget.parent
scroll_offset = container.scroll_to_region(
region,
spacing=widget.parent.gutter,
animate=animate,
speed=speed,
duration=duration,
top=top,
easing=easing,
force=force,
)
if scroll_offset:
scrolled = True

if widget.styles.dock:
scroll_offset = Offset(0, 0)
else:
scroll_offset = container.scroll_to_region(
region,
spacing=widget.parent.gutter,
animate=animate,
speed=speed,
duration=duration,
top=top,
easing=easing,
force=force,
)
if scroll_offset:
scrolled = True

# Adjust the region by the amount we just scrolled it, and convert to
# it's parent's virtual coordinate system.
Expand Down