Open Arlisaha opened 1 year ago
After further investigations, it seems that it demands to change the way settings are given to modal
, instead of using ordered vector, one could use lists :
settings = list(
c("blurring", "true"),
c("closable", "false"),
c("onApprove", htmlwidgets::JS("() => false"))
)
should become :
settings = list(
blurring = "true",
closable = "false",
onApprove = htmlwidgets::JS("() => false")
)
and modal apply part would go from :
...
shiny::tagList(lapply(settings, function(x) tags$script(attach_rule(id, "setting", x[1], x[2]))))
to :
...
shiny::tagList(lapply(names(settings), function(x) tags$script(attach_rule(id, "setting", x, settings[[x]]))))
Guidelines
Project Version
No response
Platform and OS Version
No response
Existing Issues
No response
What happened?
When attaching rules on settings,
modal
function does not check onhtml::htmlwidgets::JS
class. Consequently, when changing callbacks behavior (likeonApprove
andonDeny
settings), JS code is sent to UI as a string instead of a function.A solution could be to change :
to :
Steps to reproduce
my-btn
button should not close modal because JS function return false. However, not only it closes modal, but JS console raises an error due toonApprove
being a string instead of a function.Expected behavior
Code wrapped in
html::htmlwidgets::JS
should be escaped.Attachments
No response
Screenshots or Videos
No response
Additional Information
No response