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

Multiple cards expand together in navs_tab_card() and navs_pill_card() #558

Closed
jmbarbone opened this issue May 1, 2023 · 3 comments · Fixed by #557
Closed

Multiple cards expand together in navs_tab_card() and navs_pill_card() #558

jmbarbone opened this issue May 1, 2023 · 3 comments · Fixed by #557
Assignees

Comments

@jmbarbone
Copy link

Some nav functions cause cards to expand/full-screen together rather than independently.

library(bslib)

my_nav <- nav(
  "cards",
  card(full_screen = TRUE, "some text"),
  card(full_screen = TRUE, "more text")
)

# ok
navs_tab(my_nav)
navs_pill(my_nav)
navs_pill_list(my_nav)
page_navbar(my_nav)

# bad
navs_tab_card(my_nav)
navs_pill_card(my_nav)

In the first set, the full_screen feature is fine and each card expands independently.

navs_tab() ✔️

image

and after selecting Expand...

image

More good examples _Didn't bother to show all of them working with full screen_

navs_pill() ✔️

image

navs_pill_list() ✔️

image

page_navbar() ✔️

image

In these two, the cards both open and try to full_screen together.

navs_tab_card()

image

and after selecting Expand...

image

navs_pill_card()

image

and after selecting Expand...

image

Session Info


─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.3 (2023-03-15 ucrt)
 os       Windows 10 x64 (build 19044)
 system   x86_64, mingw32
 ui       RTerm
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/New_York
 date     2023-05-01
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bslib * 0.4.2.9000 2023-04-18 [1] Github (rstudio/bslib@dc27605)
cachem 1.0.7 2023-02-24 [1] CRAN (R 4.2.3)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.2.3)
cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.3)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.1)
digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.3)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.3)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.3)
fs 1.6.2 2023-04-25 [1] CRAN (R 4.2.3)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.3)
htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.2.3)
htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.2.3)
httpuv 1.6.9 2023-02-14 [1] CRAN (R 4.2.3)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.2.3)
jsonlite 1.8.4 2022-12-06 [1] CRAN (R 4.2.3)
later 1.3.0 2021-08-18 [1] CRAN (R 4.2.3)
lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.3)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.3)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.3)
mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.0)
pkgbuild 1.4.0 2022-11-27 [1] CRAN (R 4.2.1)
pkgload 1.3.2 2022-11-16 [1] CRAN (R 4.2.1)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.0)
processx 3.8.1 2023-04-18 [1] CRAN (R 4.2.3)
profvis 0.3.7 2020-11-02 [1] CRAN (R 4.2.0)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.3)
ps 1.7.5 2023-04-18 [1] CRAN (R 4.2.3)
purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.3)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.3)
Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.2.3)
remotes 2.4.2 2023-01-31 [1] Github (r-lib/remotes@148eda3)
rlang 1.1.1 2023-04-28 [1] CRAN (R 4.2.3)
sass 0.4.5 2023-01-24 [1] CRAN (R 4.2.3)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
shiny 1.7.4 2022-12-15 [1] CRAN (R 4.2.3)
stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.2)
stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.3)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.1)
usethis 2.1.6 2022-05-25 [1] CRAN (R 4.2.0)
vctrs 0.6.2 2023-04-19 [1] CRAN (R 4.2.3)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.3)

[1] C:/Users/jbarbone/OneDrive - Cogstate/Documents/R/win-library/4.2
[2] C:/Program Files/R/R-4.2.3/library

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@gadenbuie
Copy link
Member

Thanks for the examples and issue report! It's likely that #557 will fix this. I'll investigate tomorrow but you're welcome to try installing from that branch to see if it works for you.

@gadenbuie gadenbuie self-assigned this May 2, 2023
@gadenbuie
Copy link
Member

#557 didn't quite fix this by itself, but it will now! You can try it by using

remotes::install_github("rstudio/bslib#557")

A very minimal reprex for the issue is to include more than one card with full_screen = TRUE within a card.

card(
  card(full_screen = TRUE, "some text"),
  card(full_screen = TRUE, "more text")
)

I've adjusted our selectors to ensure we add event listeners to the correct elements. Here's another slightly more complicated example with nested full screen cards:

my_nav <- nav(
  "cards",
  card(full_screen = TRUE, "some text"),
  card(full_screen = TRUE, "more text")
)

navs_pill_card(my_nav, full_screen = TRUE)
Kapture.2023-05-02.at.12.07.32.mp4

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants