Skip to content

OptionList not fully updating on options being cleared (since v2.0.0) #5728

@davep

Description

@davep

Given this code:

from textual.app import App, ComposeResult
from textual.widgets import OptionList

class BadScrollBarApp(App[None]):

    BINDINGS = [
        ("space", "nuke")
    ]

    def compose(self) -> ComposeResult:
        yield OptionList(*[f"Option {n}" for n in range(500)])

    def action_nuke(self) -> None:
        self.query_one(OptionList).clear_options()

if __name__ == "__main__":
    BadScrollBarApp().run()

With textual v3.x, on startup, it looks as you'd expect:

Image

but then after pressing space it looks like this:

Image

note how the widget itself is still the full height of the screen despite OptionList being height: auto; and also note how the scrollbar still seems to think there is the full range of options.

Going back through Textual releases, the last time I see the expected behaviour is with Textual v1.0.0; where after pressing space we see this:

Image

Installing Textual v2.0.0 introduces the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions