Skip to content

height=None doesn't work with HorizontalScroll #69

@lyovushka

Description

@lyovushka

When I put an image that doesn't have height set (i.e. I want to use the image resolution) inside a HorizontalScroll with height=auto, it doesn't show up. Here is an example to reproduce:

from textual.app import App
from textual.widget import Widget
from textual.containers import HorizontalScroll
from textual_image.widget import Image


class TestWidget(Widget):
    DEFAULT_CSS = """
    HorizontalScroll {
        height: auto;
    }
    """

    def compose(self):
        with HorizontalScroll():
            yield Image(".venv/lib/python3.13/site-packages/textual_image/gracehopper.jpg")


class TestApp(App):
    def compose(self):
        yield TestWidget()


TestApp().run()

When I change HorizontalScroll to Horizontal it works fine. The issue happens in both Kitty and foot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions