-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Given this code:
from textual.app import App, ComposeResult
from textual.widgets import Link
class BorkedLinkApp(App[None]):
def compose(self) -> ComposeResult:
yield Link("https://example.com/", id="pre-fill")
yield Link("", id="post-fill")
def on_mount(self) -> None:
self.query_one("#post-fill", Link).url = "https://example.com/"
if __name__ == "__main__":
BorkedLinkApp().run()the result is only one link that can be seen and clicked on. This makes sense given how Link is coded, but it does highlight that the init-on-construct default behaviour and the fill-once-I-have-data default behaviour are a different experience.
Perhaps it would be a good idea to have text defaulted to url if url is set and text is empty (and perhaps the same in reverse).
Ideally it would make sense to also allow yield Link() in compose -- it would be common to not have data yet in compose, acquiring it much later after mounting has ended.
Metadata
Metadata
Assignees
Labels
No labels