Skip to content
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

Add tooltip to truncated bookmark titles #607

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

jonathan-s
Copy link
Contributor

@jonathan-s jonathan-s commented Jan 19, 2024

Fixes #606

This is what it looks like with a custom hover over a link that has an overly long title.

Screenshot 2024-01-19 at 16 04 59

Light theme.
Screenshot 2024-01-19 at 16 37 49

@@ -122,6 +122,22 @@ li[ld-bookmark-item] {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

&[data-title]:hover::after {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is a neat trick, it's super annoying that this immediately pops up when you hover over a link.

I would be more open to using the regular title attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sissbruecker I hear you. I force-pushed a new commit which makes two amendments.

  • The pop-up will only show if the text is partially hidden.
  • There is a ~300ms delay before the pop-up shows up.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Did some tweaks:

  • Restrict tooltip max width to bookmark item so longer titles don't overflow
  • Make tooltip show up on focus, for example when using keyboard navigation
  • Refactored JS so that it reuses existing bookmark item behavior, doesn't need to duplicate title into a data attribute
  • Refactored CSS to reuse Spectre CSS variables

@sissbruecker sissbruecker merged commit 81ae55b into sissbruecker:master Jan 27, 2024
@sissbruecker sissbruecker changed the title Add title to link so you can see the entire title when hover Add tooltip to truncated bookmark titles Jan 27, 2024
@jonathan-s
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Title is cut off if it is long > provide title attribute to link.
2 participants