Skip to content

Scrolling ListView with mouse leaves items boosted from hovering #6259

@ndavison

Description

@ndavison

Consider discussions!

Issues are for actionable items only.
If Textual crashes or behaves differently from the docs, then submit an issue.
If you want to know how to do something, or you have a suggestion for a new feature, then open a discussion (https://github.com/Textualize/textual/discussions/).

For realtime help, join our discord server (https://discord.gg/Enf6Z3qhVr)

The bug

If you make a ListView which is long enough to need a scroll, and you use your mouse to scroll (as in, click and hold on the scrollbar and drag up and down), and your mouse happens to move off the scrollbar sideways into the ListView as you are holding and scrolling, it will boost items based on where your cursor hovers, however some of these will stay boosted, resulting in multiple boosted ListItem items. Here is a minimum PoC:

from textual.app import App, ComposeResult
from textual.widgets import ListView, ListItem, Static

class MyApp(App):
    def compose(self) -> ComposeResult:
        yield ListView()

    def on_mount(self):
        lv = self.query_one(ListView)
        for _ in range(200):
            item = ListItem(Static(str(_)))
            lv.append(item)

if __name__ == "__main__":
    MyApp().run()

And here is a screenshot showing the issue:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions