Skip to content

[Bug]: CSS not being correctly loaded for fixed picks #75

@osenan

Description

@osenan

What happened?

This dummy module using only a single picks variable is not showing the correct styling on picks fixed UI.

library("teal")
devtools::load_all()

# --- Custom dummy teal module using a single fixed picks object ---

ui_dummy <- function(id, var_picks, ...) {
  ns <- shiny::NS(id)
  shiny::tagList(
    teal.widgets::standard_layout(
      output = shiny::verbatimTextOutput(ns("out")),
      encoding = shiny::tags$div(
        shiny::tags$label("Encodings", class = "text-primary"),
        shiny::tags$div(
          shiny::tags$strong("Variable"),
          teal.picks::picks_ui(id = ns("var"), picks = var_picks)
        )
      )
    )
  )
}

srv_dummy <- function(id, data, dataname, var_picks) {
  checkmate::assert_class(data, "reactive")
  shiny::moduleServer(id, function(input, output, session) {
    selectors <- teal.picks::picks_srv(
      picks = list(var = var_picks),
      data = data
    )

    merged <- teal.picks::merge_srv(
      id = "merge",
      data = data,
      selectors = selectors,
      output_name = "ANL"
    )

    output$out <- shiny::renderPrint({
      selected_var <- merged$variables()$var
      anl <- merged$data()[["ANL"]]
      cat("Selected variable:", selected_var, "\n")
      print(head(anl[[selected_var]]))
    })
  })
}

tm_dummy <- function(label, dataname,
                     var_picks = teal.picks::variables(
                       choices = "ADY",
                       selected = "ADY",
                       fixed = TRUE
                     )) {
  var_picks <- teal.picks::picks(teal.picks::datasets(dataname), var_picks)
  teal::module(
    label = label,
    datanames = dataname,
    ui = ui_dummy,
    ui_args = list(var_picks = var_picks),
    server = srv_dummy,
    server_args = list(dataname = dataname, var_picks = var_picks)
  )
}

# --- App ---

data <- teal_data() %>%
  within({
    ADTR <- teal.data::rADTR
  })

join_keys(data) <- default_cdisc_join_keys[names(data)]

app <- init(
  data = data,
  modules = modules(
    tm_dummy(
      label = "Dummy module (fixed picks)",
      dataname = "ADTR"
    )
  )
)

shinyApp(app$ui, app$server)

This is how it looks

Image

Probably the CSS is not being loaded correctly when we are requiring fixed ui container for picks

Relevant log output

R version 4.5.3 (2026-03-11)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=pt_BR.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Madrid
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] teal.picks_0.1.0.9239 teal_1.1.0.9031       teal.slice_0.7.1.9006
[4] teal.data_0.8.0.9002  teal.code_0.7.1       shiny_1.13.0         
[7] testthat_3.3.2       

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.1          dplyr_1.2.1              
 [3] fastmap_1.2.0             lazyeval_0.2.3           
 [5] promises_1.5.0            shinyjs_2.1.1            
 [7] rex_1.2.1                 digest_0.6.39            
 [9] mime_0.13                 lifecycle_1.0.5          
[11] waldo_0.6.2               ellipsis_0.3.3           
[13] processx_3.8.7            magrittr_2.0.5           
[15] compiler_4.5.3            rlang_1.2.0              
[17] bsicons_0.1.2             sass_0.4.10              
[19] tools_4.5.3               yaml_2.3.12              
[21] knitr_1.51                pkgbuild_1.4.8           
[23] curl_7.1.0                xml2_1.5.2               
[25] pkgload_1.5.2             websocket_1.4.4          
[27] covr_3.6.4                withr_3.0.2              
[29] purrr_1.2.2               shinyWidgets_0.9.1       
[31] desc_1.4.3                teal.logger_0.4.1.9004   
[33] roxygen2_8.0.0            xtable_1.8-8             
[35] cli_3.6.6                 crayon_1.5.3             
[37] ragg_1.5.2                generics_0.1.4           
[39] remotes_2.5.0             otel_0.2.0               
[41] rstudioapi_0.17.1         httr_1.4.8               
[43] commonmark_2.0.0          sessioninfo_1.2.3        
[45] cachem_1.1.0              chromote_0.5.1           
[47] stringr_1.6.0             rvest_1.0.5              
[49] formatR_1.14              selectr_0.5-1            
[51] vctrs_0.7.3               devtools_2.5.2           
[53] jsonlite_2.0.0            callr_3.7.6              
[55] systemfonts_1.3.2         teal.widgets_0.6.0       
[57] fontawesome_0.5.3         jquerylib_0.1.4          
[59] pak_0.9.5                 glue_1.8.1               
[61] teal.transform_0.7.1.9003 ps_1.9.2                 
[63] stringi_1.8.7             later_1.4.8              
[65] shinycssloaders_1.1.0     tibble_3.3.1             
[67] logger_0.4.1              pillar_1.11.1            
[69] htmltools_0.5.9           brio_1.1.5               
[71] R6_2.6.1                  textshaping_1.0.5        
[73] rprojroot_2.1.1           evaluate_1.0.5           
[75] backports_1.5.1           nanonext_1.7.1           
[77] memoise_2.0.1             mirai_2.5.1              
[79] renv_1.2.2                teal.reporter_0.6.1.9000 
[81] httpuv_1.6.17             bslib_0.10.0             
[83] Rcpp_1.1.1-1.1            checkmate_2.3.4          
[85] xfun_0.57                 fs_2.1.0                 
[87] usethis_3.2.1             pkgconfig_2.0.3 

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions