daattali / shinyalert

🗯️ Easily create pretty popup messages (modals) in Shiny
https://daattali.com/shiny/shinyalert-demo/
Other
241 stars 26 forks source link

scrollbars are hidden when shinyalert pops up #77

Closed JZauner closed 1 year ago

JZauner commented 1 year ago

An old comment by Ross Johnson became relevant for me:

When the shinyalert pops up, it hides the vertical scrollbar in my shiny dashboard. I've tried, unsuccessfully, adding some CSS ( .modal {overflow-y: scroll} & body {overflow-y: scroll} ) to keep the scroll bar visible. Is there another workaround that you know of?

In my App, the width of an element is used for several computations. I can otherwise fix the scrollbar in my css, but I haven´t been successful with the shinyalert. Is there a workaround/setting/possible implementation?

Thanks for the cool package btw!

daattali commented 1 year ago

That behaviour isn't done by the R package, it comes directly from the underlying javascript library (sweetalerts). After a few seconds of troubleshooting, it looks like the very first CSS rule of sweetalert is causing this - literally the first rule here https://github.com/daattali/shinyalert/blob/master/inst/assets/lib/sweetalert-1.0.1/css/sweetalert.min.css

You can try adding some CSS to counter act that, maybe something like body.stop-scrolling{overflow:auto}

I'm closing this issue since it's out of scope of the R package, but the above should hopefully help

JZauner commented 1 year ago

omg - this one line in my css literally eliminated the problem. Huge thanks!

daattali commented 1 year ago

I didn't even test what I wrote, so glad it helped :)