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

Auto width results in zero-width when applied to OptionList #4506

Closed
darrenburns opened this issue May 11, 2024 · 2 comments · Fixed by #4507
Closed

Auto width results in zero-width when applied to OptionList #4506

darrenburns opened this issue May 11, 2024 · 2 comments · Fixed by #4507
Labels
bug Something isn't working

Comments

@darrenburns
Copy link
Member

It seems like the virtual_size might not be getting set correctly inside OptionList.

In the app below I'd expect the OptionList to be able to render at the maximum cell width in the child Lines.

This app:

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

class OptionListAutoWidth(App[None]):
    CSS = "OptionList{ width: auto; }"

    def compose(self) -> ComposeResult:
        yield OptionList(*["one", "two", "three"])

app = OptionListAutoWidth()
app.run()

Produces this result:

image

Marking as a bug for now - feel free to update if I'm misunderstand.

@darrenburns darrenburns added the bug Something isn't working label May 11, 2024
@willmcgugan
Copy link
Collaborator

It's a line API widget. Looks like it is missing a get_content_width method.

Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants