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

Select initial value is out of view when first expanded #5255

Open
TomJGooding opened this issue Nov 18, 2024 · 2 comments
Open

Select initial value is out of view when first expanded #5255

TomJGooding opened this issue Nov 18, 2024 · 2 comments

Comments

@TomJGooding
Copy link
Contributor

When the Select widget is first expanded, the initial selected value is out of view when it appears further down in the list of options.

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


class SelectApp(App):
    def compose(self) -> ComposeResult:
        yield Select.from_values(
            range(20),
            value=15,
        )


if __name__ == "__main__":
    app = SelectApp()
    app.run()
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@TomJGooding
Copy link
Contributor Author

I think the problem is when the Select is first expanded, where this calls OptionList.scroll_to_highlight the region values here are all zeros:

self.scroll_to_region(
Region(0, y, self.scrollable_content_region.width, height),
force=True,
animate=False,
top=top,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant