-
Notifications
You must be signed in to change notification settings - Fork 50
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
Clear full screen state when a full-screen card is removed from the page #1003
Comments
You have a bit of a circular dependency with the library(shiny)
library(bslib)
choices <- c("cyl", "disp")
ui <- page_navbar(
sidebar = "Sidebar",
fillable = FALSE,
nav_panel(
"Tab 1",
card(
wrapper = function(...) card_body(..., height = 300, max_height = 400),
full_screen = TRUE,
card_header(
uiOutput("card_header")
),
layout_sidebar(
sidebar = selectInput(
"select_color",
"Marker color",
choices = choices,
selected = choices[1]
),
"Main"
)
)
)
)
server <- function(input, output) {
Title <- reactiveVal("TITLE")
output$card_header <- renderUI({
Title()
})
observeEvent(input$select_color, {
if(input$select_color != choices[1])
Title("NEW TITLE")
})
}
shinyApp(ui = ui, server = server) |
Yes, I know there's something bad, but this is just to give an (artifical) example. I didn't find a less artifical one (something more concrete which also causes the full screen to exit). Maybe any example showing this issue is artificial, I don't know actually. |
I suppose if |
card
card()
gain the ability to go full-screen immediately on render
The bug here is that we're not exiting full screen mode when a full-screen card is removed from the page. In the reprex app, you can actually press Escape after the new card is added to clear the full screen state because the keyboard event listeners are still enabled. #1005 will fix this by making sure we clean up full screen state when a full-screen card is removed from the page. I don't think we should do more than that -- if you want a full-screen card to stay full-screen when updated, you'll need to use more targeted outputs as @cpsievert suggested. |
card()
gain the ability to go full-screen immediately on render
This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue. |
Hello,
Look at the app below. Put the card in full-screen mode, then select
disp
in the dropdown. This causesuiOutput("content")
to re-render, and then the app exits from the full-screen mode. Then there is a problem: the full-screen icon of the card does no longer appear.System details
Output of
sessionInfo()
:The text was updated successfully, but these errors were encountered: