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

Using crosstalk in a blogdown document causing weird CSS effect #26

Open
pssguy opened this issue Jan 24, 2017 · 8 comments
Open

Using crosstalk in a blogdown document causing weird CSS effect #26

pssguy opened this issue Jan 24, 2017 · 8 comments

Comments

@pssguy
Copy link

pssguy commented Jan 24, 2017

Not sure if this is a crosstalk or blogdown issue

@timelyportfolio
Copy link

possibly something here 689fa97. The css does not appear to be encapsulated, so could be affecting entire page.

@timelyportfolio
Copy link

timelyportfolio commented Jan 30, 2017

I just found your example from the other issue. Inspecting bootstrap a little more closely, we can see

image

so the "downgraded" bootstrap 3.3.2 is present. Where can I find an example of the working version to compare?

@pssguy
Copy link
Author

pssguy commented Jan 30, 2017

If you mean by working version, anything where the CSS is as expected - without crosstalk - then any other post on that site for example will do

@timelyportfolio
Copy link

ok, then I thought it was a bootstrap version issue, but this appears to just be a bootstrap existence issue. See if this helps.

library(crosstalk)
library(htmltools)

sd <- SharedData$new(mtcars)

fs <- filter_select(
  id = "crosstalk-fs",
  label = "Select # of Cylinders",
  sharedData = sd,
  group = ~cyl 
)

browsable(
  tagList(
    h1("Test"),
    fs
  )
)

# now let's get rid of the bootstrap dependencies

# use suppressDependencies to get rid of bootstrap
# note: this works for the entire list of tags
#   so will probably be better
browsable(
  tagList(
    h1("Test"),
    fs,
    suppressDependencies("bootstrap")
  )
)

# we canmanually remove bootstrap dependency on just fs
fs_nobootstrap <- fs

attr(fs_nobootstrap, "html_dependencies") <- Filter(
  function(dep) {dep$name != "bootstrap"},
  attr(fs_nobootstrap, "html_dependencies")   
)

browsable(
  tagList(
    h1("Test"),
    fs_nobootstrap
  )
)

@pssguy
Copy link
Author

pssguy commented Jan 30, 2017

@timelyportfolio Thanks for this but hitting problem when attempting to render the site. document is Cross.Rmd

{r }
library(crosstalk)
library(htmltools)

sd <- SharedData$new(mtcars)

fs <- filter_select(
  id = "crosstalk-fs",
  label = "Select # of Cylinders",
  sharedData = sd,
  group = ~cyl 
)

  tagList(
    h1("Test"),
    fs,
    suppressDependencies("bootstrap")
  )
 serve_site()
Error: path for html_dependency not provided
Execution halted
Error in render_page(f) : Failed to render 'Cross.Rmd'
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/Rscript" "C:/Users/Andrew/Documents/R/win-library/3.3/blogdown/scripts/render_page.R" "Cross.Rmd"' had status 1 

@timelyportfolio
Copy link

I forgot that rmarkdown checks for valid path, and suppressDependencies works by changing the path to NULL, which of course is not valid. Can you try option #2? If it works, we can wrap in a simple function.

@timelyportfolio
Copy link

It seems like a set of non-Bootstrap controls would be a welcome addition to the R crosstalk family.

@pssguy
Copy link
Author

pssguy commented Jan 31, 2017

The alternative - does appear to work. I have yet to try it out on a real-world app but will get to later in day

fs_nobootstrap <- fs

attr(fs_nobootstrap, "html_dependencies") <- Filter(
  function(dep) {dep$name != "bootstrap"},
  attr(fs_nobootstrap, "html_dependencies")
)

  tagList(
    h1("Test"),
    fs_nobootstrap
  )

This is the sort of article I would want it applied to
Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants