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

With revealjs, plotly tooltip not aligned correctly #2430

Closed
4 tasks done
lizwillow opened this issue Sep 13, 2022 · 7 comments · Fixed by #2437
Closed
4 tasks done

With revealjs, plotly tooltip not aligned correctly #2430

lizwillow opened this issue Sep 13, 2022 · 7 comments · Fixed by #2437
Labels
bug Something isn't working needs-discussion Issues that require a team-wide discussion before proceeding further
Milestone

Comments

@lizwillow
Copy link

lizwillow commented Sep 13, 2022

plotly tooltip misaligned in quarto with revealjs

Rendering the following example results in an html file where the tooltip is off-center. You would need to position the pointer above and to the left of the point you want to select in order to view the information for that data point. I tried opening it in Microsoft Edge and Google Chrome and both had this issue.

---
title: "example"
author: "tmp"
format:
  revealjs
---

## slide 1

```{r}
library(plotly)
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)
```

Additional information:
Version of quarto: 1.1.189
Operating system: Windows 10 Enterprise
IDE you’re using, and its version: RStudio version 2022.7.1.554

Checklist

  • Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.
@lizwillow lizwillow added the bug Something isn't working label Sep 13, 2022
@cscheid cscheid added this to the Future milestone Sep 13, 2022
@cscheid
Copy link
Collaborator

cscheid commented Sep 13, 2022

I'm pretty sure this is happening because the tooltip is using units that are getting affected by the transform node that the revealjs format uses. Unfortunately, it means that it will be hard for us to solve this in general.

@jjallaire This is a big change, but I think we should consider forking revealjs and reworking their setup so we never have a transform node in the DOM. It wreaks havoc with a ton of downstream library expectations.

@jjallaire
Copy link
Collaborator

The counterpoint to this is that the transform is kind of Reveal's secret sauce because it allows you to target a known set of pixel dimensions with your content (no matter how the viewport is resized). It's also extremely important to be able to target images, arrows, illustrations, etc. with absolute positions. Interestingly for a lot of people used to having this level of control in PowerPoint, etc. Reveal is the first HTML slides framework that gives them this control and they love it. I could be missing something here but given all this I'm not sure we'll ever get away from the transform w/o losing some of the rest of Reveal's benefits.

@cscheid cscheid added the needs-discussion Issues that require a team-wide discussion before proceeding further label Sep 14, 2022
@cscheid
Copy link
Collaborator

cscheid commented Sep 14, 2022

I see, that makes sense, thanks.

The issue comes from HTML libraries that love to inject transient DOM nodes (tooltips, for example; I see the same thing with mermaidjs) at the end of the body or somewhere else where they try to get absolute positioning. Then, the fact that they inject the DOM node in a place with a different transform makes it impossible to line them up.

I wonder if, instead, we can make the transform node take more of the DOM, so that these libraries can't accidentally escape it.

@cderv
Copy link
Collaborator

cderv commented Sep 14, 2022

Just to share some references as we had related issue in the R package at some point and it was fixed in plotly.js directly.
See more details in rstudio/revealjs#47 (comment) and the plotly.js PR : plotly/plotly.js#5193

New plotly.js has been available in plotly R package v4.10.0

However, it seems a new issue already reported in plotly and reveal.js

In short, zoom attributes is used for the slide scaling system, and it creates the tooltip issue.

I believe this has been fixed upstream in reveal.js already and zoom is no more used. See hakimel/reveal.js@e281b32

Possibly using this commit or master for our embed reveal.js, or patching it will solve the issue here..

cderv added a commit that referenced this issue Sep 14, 2022
… JS lib

Current version use `zoom` attributes which messes up JS lib like plotly. This new version using `scale()` transform only.

Fixes #2430
@cderv
Copy link
Collaborator

cderv commented Sep 14, 2022

I confirm that using the hakimel/reveal.js@e281b32 for the revealjs version, change the scaling and fix the issue.

In HTML we had

<div class="slides" style="width: 1050px; height: 700px; zoom: 1.69843;">
<!-- slides in there-->
</div>

which becomes

<div class="slides" style="width: 1050px; height: 700px; inset: 50% auto auto 50%; transform: translate(-50%, -50%) scale(1.69843);">
<!-- slides in there-->
</div>

See the PR #2437 for a branch with the updated revealjs that fixed the issue. I share this as an example that upstream seems to have fixed this scaling issue.

jjallaire pushed a commit that referenced this issue Sep 14, 2022
… JS lib (#2437)

Current version use `zoom` attributes which messes up JS lib like plotly. This new version using `scale()` transform only.

Fixes #2430
@timbmg
Copy link

timbmg commented Dec 27, 2023

I still seem to experience this issue with vega-altair plots

@cderv
Copy link
Collaborator

cderv commented Dec 28, 2023

@timbmg this is highly possible as the original issue was a conflict in revealjs and plotly. Both being JS libraries with there own feature and configuration.

It is possible that this is the same for vega-altair too.

Can you open a new issue to track ?

Investigation will be the following then:

  • Is this an issue in RevealJS directly for supporting some feature of Vega Altair ?
  • If not, what does Quarto do that create the issue ?

Thanks.

@mcanouil mcanouil modified the milestones: Future, v1.2 Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-discussion Issues that require a team-wide discussion before proceeding further
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants