-
Notifications
You must be signed in to change notification settings - Fork 844
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
Footer tooltip appears away from cursor #5007
Comments
The tooltip will be positioned at the mouse cursor, offset by the Tooltip widget's margin. The That seems to do the correct thing from what I can tell. What additional styles did you set on the tooltip? from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Footer
class MyApp(App):
CSS = """
Tooltip {
border: tall red;
}
"""
BINDINGS = [
Binding("a", "app.bell", "Ding", tooltip="I am a tooltip"),
Binding("b", "bar", "Bar Bar Bar", tooltip="There can be only one"),
Binding("c", "baz", "Baz Baz Baz", tooltip="I'm too old for this shit"),
Binding("d", "egg", "Egg Egg Egg", tooltip="Get away from here, you b****!"),
]
def compose(self) -> ComposeResult:
yield Footer()
MyApp().run() |
I can see the behaviour that I consider "weird" in your example app too. It seems a bit far away from the cursor for me (so far that I assumed it was a bug), to the point where it almost doesn't feel like a "tooltip" associated with the key in the footer. Kind of like it's detached. When we chatted about it, I think we agreed the inflect behaviour felt wrong - should the tooltip not just appear above where the cursor is? If it runs out of space, rather than "inflecting", should it not just "slide horizontally a bit" so that it's not clipping off screen. |
You can change the margin so that it is a bit closer to the cursor. the tall / wide borders add additional space, so might benefit from a change in margin. It feels right to me. I like the way that a corner points to the thing being hovered. But I'm not apposed to offering alternatives. We have only a single value for We might also want to be able to change the default position of the tooltip, like centered above / below. From a bit of googling, it seems that is more typical than the current up and right a bit behavior. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
I think it's related to the margin on the toolip and how that interacts with the constrain: inflect CSS rule.
(No MRE as we discussed this in office and Will has context for it)
The text was updated successfully, but these errors were encountered: