Skip to content

Hovering links in markup changes state of all links with identical action / parameter #1587

Open
@mitosch

Description

@mitosch

Issue Description

Hovering one link will change the hover state of all links having the same action/params.

Given the example below, the links 1, 3 and 4 are changing the state together:

Screenshot from 2023-01-17 11-50-44

Further analysis:

  • The link_id of those 3 links are the same (see textual log).

Working Example

from __future__ import annotations

from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static

from textual import log


TEXT = """
Lorem ipsum dolor sit [@click=link('amet')](1) amet[/]
 , consetetur sadipscing elitr, sed diam nonumy
eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At [@click=link('vero')](2) vero[/] eos et accusam et justo duo
dolores et ea rebum.

Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor
sit amet. Lorem ipsum dolor sit [@click=link('amet')](3) amet[/], consetetur
sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At [@click=link('amet')](4) vero[/]
eos et accusam et justo duo dolores et ea rebum.

Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit [@click=link('no-amet')](5) amet[/].
"""


class LinkableStatic(Static):
    def watch_highlight_link_id(self, link_id: str) -> None:
        log("highlight link:", link_id)


class LinkTesterApp(App):
    def compose(self) -> ComposeResult:
        yield Header()
        yield Footer()

        yield LinkableStatic(TEXT)


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

Metadata

Metadata

Assignees

Labels

TaskbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions