You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree to follow this project's Contributing Guidelines.
Project Version
No response
Platform and OS Version
No response
Existing Issues
No response
What happened?
An already closed #348 introduced the as_is parameter to be passed to the hide_modal, show_modal and remove_modal functions.
This parameter, a logical, is not being handled in the body of the function itself causing this functions to always work as if they were passing the as_is = FALSE which is confusing because the default for this parameter is TRUE
Steps to reproduce
library(shiny)
library(shiny.semantic)
mod_ui<-function(id) {
ns<- NS(id)
tagList(
shiny.semantic::modal(
div("Inspect the server code"),
id= ns("modal")
),
# The following should not work but it's working because asis is always as FALSEshiny.semantic::action_button(
input_id= ns("open_as_is_true"),
class="red",
"Open modal with as_is TRUE passing the non-namespaced id"
),
# The following should work but it's notshiny.semantic::action_button(
input_id= ns("open_as_is_true_namespaced"),
class="red",
"Open modal with as_is TRUE passing the namespaced id"
),
# The following is working as expected because asis is always as FALSEshiny.semantic::action_button(
input_id= ns("open_as_is_false"),
class="yellow",
"Open modal with as_is FALSE passing the non-namespaced id"
),
hr(),
h3("shiny.semantic::show_modal Source code:"),
div(
div(style="font-family: monospace; background-color: #f4f4f4; color: #c7254e; padding: 5px; border: 1px solid #ccc;",
HTML(
' function (id, session = shiny::getDefaultReactiveDomain(), asis = TRUE) {<br>   id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)<br>   session$sendCustomMessage("showSemanticModal", list(id = id, action = "show"))<br>  }'
)
)
)
)
}
mod_server<-function(id) {
moduleServer(id, function(input, output, session) {
observeEvent(input$open_as_is_true, {
shiny.semantic::show_modal(
id="modal",
asis=TRUE
)
})
observeEvent(input$open_as_is_true_namespaced, {
shiny.semantic::show_modal(
id=session$ns("modal"),
asis=TRUE
)
})
observeEvent(input$open_as_is_false, {
shiny.semantic::show_modal(
id="modal",
asis=FALSE
)
})
})
}
ui<-shiny.semantic::semanticPage(
mod_ui("modal")
)
server<-function(input, output, session) {
mod_server("modal")
}
shinyApp(ui, server)
Expected behavior
As declared in the UI function
Attachments
No response
Screenshots or Videos
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Guidelines
Project Version
No response
Platform and OS Version
No response
Existing Issues
No response
What happened?
An already closed #348 introduced the as_is parameter to be passed to the
hide_modal
,show_modal
andremove_modal
functions.This parameter, a logical, is not being handled in the body of the function itself causing this functions to always work as if they were passing the
as_is = FALSE
which is confusing because the default for this parameter isTRUE
Steps to reproduce
Expected behavior
As declared in the UI function
Attachments
No response
Screenshots or Videos
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: