trafficonese / leaflet.extras2

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras2/
GNU General Public License v3.0
85 stars 19 forks source link

Scroll in Sidebar not working with Firefox #66

Open Daphnisd opened 3 months ago

Daphnisd commented 3 months ago

I love the sidebar feature provided by this package.

One issue I have, is when including multiple (more than 8) choices in a selectInput,there is some bug which doesn't allow you to use the sidebar of the select input to scroll down to the 9th option.

Using the code from https://github.com/trafficonese/leaflet.extras2/blob/master/inst/examples/sidebar_app.R, you can see the issue when adding options to the selectInput e.g.

selectInput("label", "Label", choices = c("brewery", "address","zipcode", "village", "option5", "opion6", "option7", "option8", "option9"))

trafficonese commented 3 months ago

I cannot reproduce that. I can scroll down to option 9. Could you include your sessioninfo::session_info() ?

image

Daphnisd commented 3 months ago

Thank you for checking. It looks like it's partly browser related, with edge and chrome allowing scrolling but Firefox doesn't. Clicking on the scroll bar doesn't work in any browser.

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.0 (2023-04-21 ucrt)
 os       Windows 11 x64 (build 22631)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_Australia.utf8
 ctype    English_Australia.utf8
 tz       Australia/Hobart
 date     2024-04-04
 rstudio  2023.09.1+494 Desert Sunflower (desktop)
 pandoc   NA

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package         * version date (UTC) lib source
 bslib             0.6.1   2023-11-28 [1] CRAN (R 4.3.2)
 cachem            1.0.8   2023-05-01 [1] CRAN (R 4.3.2)
 class             7.3-21  2023-01-23 [2] CRAN (R 4.3.0)
 classInt          0.4-10  2023-09-05 [1] CRAN (R 4.3.3)
 cli               3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crosstalk         1.2.1   2023-11-23 [1] CRAN (R 4.3.2)
 DBI               1.2.2   2024-02-16 [1] CRAN (R 4.3.3)
 digest            0.6.31  2022-12-11 [1] CRAN (R 4.3.0)
 dplyr             1.1.4   2023-11-17 [1] CRAN (R 4.3.3)
 e1071             1.7-14  2023-12-06 [1] CRAN (R 4.3.2)
 ellipsis          0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
 fansi             1.0.6   2023-12-08 [1] CRAN (R 4.3.2)
 fastmap           1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fontawesome       0.5.2   2023-08-19 [1] CRAN (R 4.3.2)
 generics          0.1.3   2022-07-05 [1] CRAN (R 4.3.0)
 glue              1.6.2   2022-02-24 [1] CRAN (R 4.3.0)
 htmltools         0.5.7   2023-11-03 [1] CRAN (R 4.3.2)
 htmlwidgets       1.6.4   2023-12-06 [1] CRAN (R 4.3.2)
 httpuv            1.6.14  2024-01-26 [1] CRAN (R 4.3.2)
 jquerylib         0.1.4   2021-04-26 [1] CRAN (R 4.3.0)
 jsonlite          1.8.8   2023-12-04 [1] CRAN (R 4.3.2)
 KernSmooth        2.23-20 2021-05-03 [2] CRAN (R 4.3.0)
 later             1.3.2   2023-12-06 [1] CRAN (R 4.3.2)
 lattice           0.21-8  2023-04-05 [2] CRAN (R 4.3.0)
 leaflet         * 2.2.1   2023-11-13 [1] CRAN (R 4.3.2)
 leaflet.extras2 * 1.2.2   2023-08-21 [1] CRAN (R 4.3.3)
 lifecycle         1.0.4   2023-11-07 [1] CRAN (R 4.3.2)
 magrittr          2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
 memoise           2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime              0.12    2021-09-28 [1] CRAN (R 4.3.0)
 pillar            1.9.0   2023-03-22 [1] CRAN (R 4.3.0)
 pkgconfig         2.0.3   2019-09-22 [1] CRAN (R 4.3.0)
 promises          1.2.1   2023-08-10 [1] CRAN (R 4.3.2)
 proxy             0.4-27  2022-06-09 [1] CRAN (R 4.3.0)
 R6                2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp              1.0.12  2024-01-09 [1] CRAN (R 4.3.2)
 rlang             1.1.3   2024-01-10 [1] CRAN (R 4.3.3)
 rstudioapi        0.15.0  2023-07-07 [1] CRAN (R 4.3.2)
 sass              0.4.8   2023-12-06 [1] CRAN (R 4.3.2)
 sessioninfo       1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 sf              * 1.0-15  2023-12-18 [1] CRAN (R 4.3.2)
 shiny           * 1.8.1.1 2024-04-02 [1] CRAN (R 4.3.0)
 sp              * 1.6-0   2023-01-19 [1] CRAN (R 4.3.0)
 tibble            3.2.1   2023-03-20 [1] CRAN (R 4.3.0)
 tidyselect        1.2.1   2024-03-11 [1] CRAN (R 4.3.0)
 units             0.8-5   2023-11-28 [1] CRAN (R 4.3.3)
 utf8              1.2.4   2023-10-22 [1] CRAN (R 4.3.3)
 vctrs             0.6.5   2023-12-01 [1] CRAN (R 4.3.3)
 xtable            1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] C:/Users/daphnis/AppData/Local/R/win-library/4.3
 [2] C:/Program Files/R/R-4.3.0/library
trafficonese commented 3 months ago

Yeah it appears to only happen in Firefox (my version is 124.0.2), but I have found a temporary fix for it.

If you include the following in your ui.R, after the creation of the sidebar. tags$script("L.DomEvent.on(L.DomUtil.get('mysidebarid'), 'mousewheel', L.DomEvent.stopPropagation);")

make sure to use the correct id, for the example-app the Id of the sidebar is mysidebarid.

trafficonese commented 3 months ago

I am a bit hesitant to include the fix in the package itself, since other browsers work correctly. But I will leave the issue open for others to see.

Daphnisd commented 3 months ago

Thank you, this fix solves the issue! I note that you can't click and drag the scroll bar in any browser, but as scrolling now works this seems minor.