darrenburns/textual-autocomplete

Can't use multiple AutoComplete's inside a Vertical (v2)

Opened this issue · 0 comments

The following example only shows the Input followed by one AutoComplete, when I expected two AutoComplete instances. There is a missing input box below the second "this works".

I want to be able to pick out one of ~60 list entries reasonably quickly, and to do so on 5-10 inputs, forming a team of those names.

Screenshot 2024-09-15 at 16 19 09
from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Input
from textual_autocomplete import AutoComplete, Dropdown, DropdownItem


class TextInputApp(App):
    def compose(self) -> ComposeResult:
        yield Vertical(
            Input(placeholder="This works"),
            AutoComplete(
                Input(placeholder="this works", id="auto1"),
                Dropdown(
                    items=[
                        DropdownItem("Glasgow"),
                        DropdownItem("Edinburgh"),
                    ]
                ),
            ),
            ### This one doesn't work:
            AutoComplete(
                Input(placeholder="this doesn't work", id="auto2"),
                Dropdown(
                    items=[
                        DropdownItem("Glasgow"),
                        DropdownItem("Edinburgh"),
                    ]
                ),
            ),
        )


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