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

Disabled widgets prevent mouse scrolling #4242

Closed
xavierog opened this issue Feb 29, 2024 · 4 comments · Fixed by #4297
Closed

Disabled widgets prevent mouse scrolling #4242

xavierog opened this issue Feb 29, 2024 · 4 comments · Fixed by #4297
Assignees
Labels
enhancement New feature or request Task

Comments

@xavierog
Copy link
Contributor

Context

My application used to disable entire Collapsible Contents, which is how I noticed this issue in the first place.

Notes:

  • in this issue, "scrolling" and "scroll using the mouse" are both short for "scrolling using the mouse scroll wheel or any similar device"
  • this issue is similar to Disabled widgets should still scroll #1912 but applies to enabled containers.

Expectations

When an enabled scrollable container contains disabled widgets, disabled widgets should not prevent scrolling the container.

Current behaviour

The MRE below reflects the issue. It alternates enabled and disabled widgets in a way that prevents effective scrolling.

textual-scroll-mre

#!/usr/bin/env python3
from textual.app import App, ComposeResult
from textual.widgets import Static

class MyBoringWidget(Static, can_focus=True):
    DEFAULT_CSS = "MyBoringWidget { height: 90%; background: $primary; border: tall yellow; }"

class ScrollMRE(App):
    DEFAULT_CSS = "Static { text-align: center; }"
    def compose(self) -> ComposeResult:
        instructions = 'Place your cursor in the middle of the app and try scrolling to the bottom using the mouse'
        yield Static(instructions)
        for i in range(10):
            yield MyBoringWidget(disabled=bool(i%2))
            yield Static(instructions)

if __name__ == "__main__":
    app = ScrollMRE()
    app.run()

Textual Diagnostics

Versions

Name Value
Textual 0.52.1
Rich 13.7.0

Python

Name Value
Version 3.11.8
Implementation CPython
Compiler GCC 13.2.0
Executable ~/whatever/venv/bin/python3

Operating System

Name Value
System Linux
Release 6.6.15-amd64
Version #1 SMP PREEMPT_DYNAMIC Debian 6.6.15-2 (2024-02-04)

Terminal

Name Value
Terminal Application tmux (3.4)
TERM xterm-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=232, height=54
legacy_windows False
min_width 1
max_width 232
is_terminal False
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None
Copy link

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

xavierog added a commit to xavierog/moulti that referenced this issue Feb 29, 2024
Disabled widgets prevent scrolling[1]. This side-effect can be reduced
by disabling focusable widgets instead of the entire Collapsible
Contents.

[1] Textualize/textual#4242
@willmcgugan
Copy link
Collaborator

Scrolling with the scrollbar works. This issue relates to scrolling with the wheel / gestures.

@davep davep added enhancement New feature or request Task labels Mar 14, 2024
@davep davep self-assigned this Mar 14, 2024
davep added a commit to davep/textual-sandbox that referenced this issue Mar 14, 2024
davep added a commit to davep/textual that referenced this issue Mar 14, 2024
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

@xavierog
Copy link
Contributor Author

Now that the fix is available in main, I confirm the issue no longer happens on my side (tested with both the MRE and my application). Thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants