-
Notifications
You must be signed in to change notification settings - Fork 19
Link preview of a link inside an h2 incorrectly inherits h2 styling for preview content? #584
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
Comments
I tried just moving the tooltip generated outside the Checking the code where we create the tooltip and inject it into the DOM at: https://github.com/readthedocs/addons/blob/main/src/linkpreviews.js#L184-L198, it seems that we are using https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement with I quickly check the source of the page and I found Firefox telling me the page is malformed. It has a closing |
I found the issue. The tooltip is added as sibling of the |
I simplify this by always adding the tooltip before closing the |
We deployed the fix. It should work as expected now. |
confirmed working, thanks! |
Hi! We just moved the Hypothesis documentation from
sphinx-hoverxref
to the Link Preview addon. After doing so, I noticed that some of the tooltips display poorly:https://hypothesis.readthedocs.io/en/latest/index.html
Where the link is inside an
h2
, and thedata-linkpreview-href
tooltip div is placed inside of that containingh2
element, meaning the entire tooltip content inherits the h2's font size / font weight / etc styles.I checked other preview links inside headers, like the
@given
link in this header, but those appended the tooltip to a rootreadthedocs-linkpreviews
element and display fine, since they don't inherit theh2
styles.I'm not sure what is causing the behavior difference here, but I'm hoping you guys have some idea!
A confounding factor is that on the page where the tooltip div displays poorly, we have some custom css (source). I tried disabling these styles locally in devtools, to no visible effect, but perhaps their mere presence changes the build process for readthedocs somehow?
Hypothesis issue: HypothesisWorks/hypothesis#4347
The text was updated successfully, but these errors were encountered: