Here is a simple example that illustrates the error I am experiencing:
library(shiny)
run_with_enter <- '
$(function() {
var $els = $("[data-proxy-click]");
$.each(
$els,
function(idx, el) {
var $el = $(el);
var $proxy = $("#" + $el.data("proxyClick"));
$el.keydown(function (e) {
if (e.keyCode == 13) {
$proxy.click();
}
});
}
);
});
'
ui1 <- function(){
tagList(
div(id = "login",
fluidPage(
textInput("uid", "Username"),
tagAppendAttributes(
passwordInput("pwd", "Password"),
`data-proxy-click` = "Login"
),
br(),
actionButton("Login", "Log in", class = "btn-success"),
htmlOutput("login_attempt")
)),
tags$style(type="text/css", "#login {font-size:10px; text-align: left;position:absolute;top: 40%;left: 50%;margin-top: -100px;margin-left: -150px;}")
)}
ui = (htmlOutput("page"))
server <- function(input, output, session) {
observeEvent(input$Login, {
cat("Login attempted \n")
})
output$page <- renderUI({
div(class="outer",do.call(bootstrapPage,c(tags$br(tags$script(HTML(run_with_enter))),ui1())))
})
}
shinyApp(ui, server)
Upon running the app, I notice that the text "br" is displayed in the top-left corner, while the rest of the application functions as expected. Further investigation has led me to identify the issue within this code snippet:
tags$br(tags$script(HTML(run_with_enter))
At this point, I am unsure how to address this issue. Changing the "br" tag to another valid HTML tag, such as "head", results in the replacement of the text in the top-left corner with the new tag.