RinteRface / shinybulma

🌐 Bulma.io for Shiny
https://rinterface.github.io/shinybulma/
Other
111 stars 15 forks source link

bulma.js as recently merged in #31raises an error in JS console #32

Open thothal opened 3 years ago

thothal commented 3 years ago

bulma.js (updated in #31) is raising an error as can be seen in the JS console:

bulma.js:1 Uncaught TypeError: Cannot read property 'addEventListener' of null at t.value (bulma.js:1) at new t (bulma.js:1) at a. [as navbar] (bulma.js:1) at bulma.js:1 at Function.a.each (bulma.js:1) at Function.value (bulma.js:1) at bulma.js:1 at Function.a.each (bulma.js:1) at Function.a.parseDocument (bulma.js:1) at HTMLDocument. (bulma.js:1)

DivadNojnarg commented 3 years ago

Could you show the code to capture that error?

thothal commented 3 years ago

Took a while to track the error down, but here is a minimal reprex:

library(shiny)
library(shinybulma)
shinyApp(bulmaPage(bulmaNavbar()), function(...) {})

So it is the bulmaNavbar item.

DivadNojnarg commented 3 years ago

bulmaJS has an API for navbar. It's probably conflicting with the current implementation. By the way I don't manage to access to the bulmaJS doc anymore. I'll check later ;)

thothal commented 3 years ago

I tried that already, this is not the case. My guess is that bulmaJS requires a .navbar-burger and in abseince raises this error.

Try:

shinyApp(
   bulmaPage(
      bulmaNavbar(
         bulmaNavbarBurger()
      )
   ), function(...) {}
)

and the error is gone.

DivadNojnarg commented 3 years ago

In many template I’v seen, the burger is included in the navbar template by default, only shown when screen size reaches a specific threshold. bulmaNavbarBurger should be internal to the template and not exported to the end user. As you mentioned, this would fix the issue.