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

fix(ioslides): Shiny-specific initialization #2516

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Sep 12, 2023

Fixes #2514
Fixes rstudio/shiny#3894

Currently, ioslides waits for the DOMContentLoaded event to initialize the slides, assuming that the <slides> markup will be there when that event happens.

Beacuse the slides are loaded via dynamic UI with uiOutput() (not just the slides, but the app content for any Shiny app in R Markdown), and due to recent changes in Shiny, the dynamic UI isn't present in the DOM yet. This is due to recent changes in Shiny that make dynamic UI rendered asynchronous.

This PR is a minimal fix that adds special initialization code for Shiny in the ioslides pandoc template and prevents the ioslides slide-deck.js from trying to initialize slides automatically in a shiny context.

This works because the slides markup, including the new initialization code, are all added to the page at the same time, so by the time loadDeck() is called we have a strong guarantee that <slides> is present.

cc @cderv @cpsievert (I can't request reviewers)

Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

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

Ok good. this is a simple enough solution. That suppose to change the external deps slide-deck.js to add shiny specific thing, in two places. So maybe I'll move the loading in the template.

However, it seems the issue is that <slides> element is not there yet. So my first thought would have been to improve the defer code until the element exists.

Would that work too ?

I'll also wait for @cpsievert (or anyone else from shiny team) to review before merging.

@cderv cderv merged commit 78aca81 into rstudio:main Sep 13, 2023
@gadenbuie gadenbuie deleted the fix/2514-ioslides-shiny branch October 23, 2023 15:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest shiny breaks ioslides demo app for IDE shiny presentation renders empty black screen
3 participants