rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.37k stars 1.87k forks source link

plot brush issue after update to 1.9.0 #4110

Closed toomish closed 2 months ago

toomish commented 2 months ago

System details

Browser Version: firefox 128.0.3

Output of sessionInfo():

R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.12.0
LAPACK: /usr/lib/liblapack.so.3.12.0

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

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

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

other attached packages:
[1] shiny_1.9.0       lattice_0.22-6    data.table_1.15.4

loaded via a namespace (and not attached):
 [1] digest_0.6.36     later_1.3.2       R6_2.5.1          httpuv_1.6.15
 [5] fastmap_1.2.0     magrittr_2.0.3    parallel_4.4.1    htmltools_0.5.8.1
 [9] lifecycle_1.0.4   promises_1.3.0    cli_3.6.3         xtable_1.8-4
[13] grid_4.4.1        compiler_4.4.1    mime_0.12         Rcpp_1.0.13
[17] rlang_1.1.4       box_1.2.0

Example application or steps to reproduce the problem

```R library(shiny) shinyApp( ui = fluidPage( actionButton("newplot", "New plot"), plotOutput("plot", brush = brushOpts("brush", delay = 5000, direction = "x")), verbatimTextOutput("text")), server = function(input, output) { output$plot <- renderPlot({ input$newplot x <- seq(-20, 20) y <- x * x plot(x, y, ann = FALSE) }) output$text <- renderText({ if (!is.null(input$brush)) paste("xmin", round(input$brush$xmin, 1), "xmax", round(input$brush$xmax, 1)) else "nothing" }) } ) ``` ### Describe the problem in detail After update shiny to 1.9.0 some places of plot cannot be selected with brush. For example in my sample application from left and top sections of plot it's impossible to begin selection. With previous shiny version 1.8.1.1 there was no problem.
cpsievert commented 2 months ago

Hi @toomish, thanks for the report. Unfortunately, I can't seem to replicate the behavior you're seeing. Would you mind adding a screen-recording of the expected vs unexpected behavior? Also, please let us know what browser you're using and whether you see any JS console errors.

toomish commented 2 months ago

Firefox 128.0.3, but the issue appeared only after updating shiny to 1.9.0

old shiny (1.8.1.1) works as expected:

https://github.com/user-attachments/assets/810c64e2-14f8-4a40-83b7-720e3d434278

new shiny (1.9.0) impossible to initiate selection when mouse pointer in left or top sections of the plot:

https://github.com/user-attachments/assets/a91b626c-1e7c-4e58-961d-152b0d29010f

There are no errors in JS console.

toomish commented 2 months ago

With chromium all works as expected. It seems that this is firefox compatibility problem with new release.

cpsievert commented 2 months ago

Thanks for the info and the great screencast. Also, super weird that I'm not seeing the same behavior in Firefox 128.0.3 on MacOS 14.5. Maybe try disabling the browser cache and/or do a hard refresh?

toomish commented 2 months ago

Disabling cache, hard refresh did not help.

I'm not fully sure, but I think problem can be caused by the screen size: 13-inch screen with 3840x2400 resolution.

When screen is zoomed out to 50% problem seems to be disappeared:

https://github.com/user-attachments/assets/423eddcd-33e9-4a4d-bce5-d6926556e6ed

With original screen zoom (100%) reproduced:

https://github.com/user-attachments/assets/d35aa04f-1f1d-4641-b861-de716989a654

With previous shiny version (1.8.1.1) there was no such problem.

toomish commented 2 months ago

With chromium issue is also reproduced when screen is zoomed in:

https://github.com/user-attachments/assets/472932ec-b7c5-4805-8c52-5c2c614b736f

jcheng5 commented 2 months ago

This is almost certainly my issue, I was in this code for the latest release. I’ll take a look in the morning, sorry about this!

jcheng5 commented 2 months ago

@toomish Can you try installing from the fix-clipping-regression branch (e.g. pak::pak("rstudio/shiny@fix-clipping-regression")) and see if that fixes it for you, and whether it introduces any other problems?

toomish commented 2 months ago

@toomish Can you try installing from the fix-clipping-regression branch (e.g. pak::pak("rstudio/shiny@fix-clipping-regression")) and see if that fixes it for you, and whether it introduces any other problems?

Yes, it is really fixed. Thank you! Hope will be available in CRAN soon.