Skip to content
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

Error message out of bounds if DT hasn't been rendered before #1084

Open
3 tasks done
averissimo opened this issue Sep 8, 2023 · 0 comments
Open
3 tasks done

Error message out of bounds if DT hasn't been rendered before #1084

averissimo opened this issue Sep 8, 2023 · 0 comments

Comments

@averissimo
Copy link

The error rendering message by shiny has height = 0 and absolute positioning. This means that if the data table hasn't been rendered before, then the error is placed out of bounds from the parent div.

This may result on visual glitches such as the example below shows. (when pressing the button twice the problem is no longer visible as the parent element has a non-zero height.

image

image

Reproducible code:

library(shiny)
library(DT)

sytle_css <- "
  background-color: rgba(159,226,191,100);
  padding: 0.3em;
  border: solid green 1px;
  "

shinyApp(
  ui = fluidPage(
    fluidRow(
      column(12, actionButton("toggle_error", "Toggle error")),
      column(12, tags$div( style = sytle_css, tags$h2("A table"), DTOutput('tbl')) )
    )
  ),
  server = function(input, output) {
    output$tbl = renderDT({
      shiny::validate(
        shiny::need(
          input$toggle_error && input$toggle_error %% 2 == 1,
          "Forced error that can be toggled by pressing the button above"
        )
      )
      iris
    }, options = list(lengthChange = FALSE))
  }
)

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('DT'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/DT').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant