quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.64k stars 298 forks source link

Revealjs presentation footnote citations-hover broken #7100

Open drganghe opened 10 months ago

drganghe commented 10 months ago

Bug description

The citations-hover in Revealjs footer seems not behavior as it should be. See below example.

https://drganghe.github.io/energy-climate-policy/lectures/lecture4.html#/energy-and-their-conversions

Steps to reproduce

format: revealjs: theme: white slide-number: true preview-links: auto link-external-newwindow: true citations-hover: true auto-stretch: true r-fit-text: true center: true scrollable: true css: /custom.css

Expected behavior

It should show a preview of full reference if hover on the citation.

Actual behavior

No response.

Your environment

RStudio: 2023.06.0 Build 421 Windows 11

Quarto check output

No response

dragonstyle commented 10 months ago

I was able to reproduce this, but only after navigating (if I just follow your link and hover, things appear to work). I noticed a JS error that was present in the older version of the pre-release that this was produced with. Would you try updating to the latest version of the Quarto pre-release and see whether the issue persists?

drganghe commented 10 months ago

I tried the most recent pre-release. This is interesting. If I refresh the page, the hover would show. But if I move the slides back and forth without refreshing it. The hover citation does not show.

cderv commented 10 months ago

This is reproducible example

---
title: "Test"
format:
  revealjs:
    citations-hover: true
bibliography: packages.bib
---

```{r}
knitr::write_bib("knitr", "packages.bib")

Slide

Some content with citation [@R-knitr]

::: footer Source: @R-knitr :::

References

::: {#refs} :::



We can see the behavior by going back and forth on the slide with citation. It seems to happen only when citation is in the footer. 

Possibly a conflict with quarto footer feature for revealjs... 
cderv commented 10 months ago

Possibly a conflict with quarto footer feature for revealjs...

This is exactly what happens. The footer feature from Quarto with revealjs is done by triggering a slidechanged event that will modify the footer on each slide depending on the footer provided in each slide.

The hovering works by setting up tippy to hover some DOM element. But this works when the footer in question is in the slide, but when slide changed the DOM changes and there is no more hover set up when going back on the slide. Hovering setup is done only once when DOMContentLoaded

Maybe we can find a solution to make the two work together, but for now citation hovering in footer text does not work, and should be avoided.