-
Notifications
You must be signed in to change notification settings - Fork 7
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
Tooltips: sphinx-hoverxref
popup implementation
#239
Tooltips: sphinx-hoverxref
popup implementation
#239
Comments
Yes, and it's because it's not maintained anymore. The last commit was 4 years ago: https://github.com/calebjacob/tooltipster
I would avoid this approach if possible because the underlying library is not well maintained anyways. We will either, replace the library now or in the future anyways. So, I wouldn't re-implement it using an old library at this point.
This is the path I was following. I found Today I found that
Hrm, it doesn't seem this is gonna happen soon, tho. |
Most browsers already have this feature actually 1 -- Firefox is the outlier here, it's only in nightly right now. I feel like our time frame for this feature is still a little ways out, perhaps after we get a wider distribution on the current work in addons? So, time frames might even align too. That is, we might not have to drop the work we have here already, and instead could use our current dependency until we swap to native only. Or do some polyfill if the native feature is missing and back down to the current library. My main concern is reworking our dependency here twice. I think we should ultimately land on using native features if we can. Investing in a secondary intermediate dependency doesn't feel super useful for that. If Footnotes |
sphinx-hoverxref
popup implementation
I've used popper.js/floating-ui before, and I have good experience with it. As far as I know it's a pretty well maintained library. I haven't thought of the native implementation before, but I like the idea, so I'll take a look into that first (and probably check floating-ui if they've had any discussions/thoughts around that). My initial reaction is skeptical towards the native implementation, but since I haven't looked into it before, so I'm ready to be surprised :D |
I'm guessing that none of these libraries are operating as a polyfill for popover, but maybe I'm wrong. Since my last comment, and since 2024-04, popover is now in Firefox and Firefox Mobile, and has been in all other browsers since early last year. So I'm inclined to lean into this feature, rather than settle into a library that will naturally self-deprecate due to the overlap. But if there are strong reasons to use a third party library here, that might influence the decision. |
Ok so unless I'm misunderstanding this addon, a very strong argument against using native popover is positioning. The big advantage of using popper.js/floating-ui is that it deals with positioning really well. Native popover doesn't seem to do any of that, which makes me think that implementation using native popover will be much more time-consuming. So my vote is definitely for popper.js/floating-ui for now. What do you think? |
I'm fine going in that direction 👍 |
Floating ui is a bit more low-level than tippy js, which is currently used in
Is it ok to leave that div in the DOM, and just hide it. And then show it again once the link is hovered again? |
I'm not sure about the In any case, the initial implementation could use
I suppose there is no problem. Maybe hovering a lot of links could make the page to become slow, tho. We don't need to premature optimize it, so either is fine to me. |
I just proposed what's already in |
Yeah, that's fine. |
@humitos how should styling be handled? Currently (the way sphinx-hoverxref is implemented), things are displayed using the styles that are already on the page (which might be completely different from the content in the link). I assume that's ok, because the intention is that the links are all under the same site, right? |
Yes, this is correct. Since we are using links from the same project, the style should match. However, in the current (Sphinx) implementation we are linking to external resources as well (e.g. using Unfortunately, we don't have a good answer for the external link use cases; so we can skip it for now. If you have ideas about how to implement this properly, feel free to share them here or open a new issue. |
Closes #239 Closes #20 --------- Co-authored-by: Manuel Kaufmann <[email protected]>
![Screenshot_2024-11-06_10-52-12](https://github.com/user-attachments/assets/adea8251-4b3d-4378-a28d-0f3fdf44fdb2) Required by readthedocs/addons#379 Required by readthedocs/readthedocs.org#11746 Closes readthedocs/addons#239
I couldn't find an issue where we talked about this specifically, but it has come up in a few calls.
The problem we have currently with hoverxref is that the popup library implementation needs to be replaced as we port it to an addon. I believe the issue here was that the library was a jQuery library? @humitos is this correct?
Options we should weigh:
Footnotes
The HTML
popover
attribute is upcoming, and is currently part of Interop 2024. Firefox is the outlier here currently, though there is an implementation in nightly. A hybrid approach would be to do a polyfill or something similar for unsupported browsers. ↩The text was updated successfully, but these errors were encountered: