nav_menu in page_navbar has challenging keyboard navigation
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
Keyboard navigation gets stuck in the nav_menu when used in page_navbar
When reviewing the keyboard navigation for web accessibility, I'm finding it challenging to transition from page to page in the navbar when there is a nav_menu with multiple panels.
I understand that the left and right arrows move from page to page in the navbar, but after entering the nav_menu, it isn't clear how to exit in with keyboard navigation. Shift Tab only closes the menu, but doesn't let you reverse to the second tab.
By comparison the bootstrap navbar examples do not have this behavior. Navigation is much easier into and out of the dropdown menu: https://getbootstrap.com/docs/5.3/components/navbar/
If there's a keystroke that solves this in bslib, please let me know! Otherwise, I'm concerned it becomes a keyboard trap.
library(shiny)
library(bslib)
ui <- function() {
page_navbar(
id = "main_nav",
nav_panel("first"),
nav_panel("second"),
nav_menu(
"Menu dropdown",
nav_panel("menu1"),
nav_panel("menu2")
)
)
}
server <- function(input, output) {
}
shinyApp(ui, server)
Session Info
─ Session info ─────────────────────────────────────────────────────── setting value version R version 4.6.0 (2026-04-24 ucrt) os Windows 11 x64 (build 26200) system x86_64, mingw32 ui RStudio language (EN) collate English_United States.utf8 ctype English_United States.utf8 tz America/New_York date 2026-08-18 rstudio 2026.04.0+526 Globemaster Allium (desktop) pandoc NA quarto 1.9.36 @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe
─ Packages ───────────────────────────────────────────────────────────
package * version date (UTC) lib source
bslib * 0.12.0 2026-08-04 [1] CRAN (R 4.6.1)
cachem 1.1.0 2024-05-16 [1] CRAN (R 4.6.0)
cli 3.6.6 2026-04-09 [1] CRAN (R 4.6.0)
devtools 2.5.2 2026-04-30 [1] CRAN (R 4.6.1)
digest 0.6.39 2025-11-19 [1] CRAN (R 4.6.0)
ellipsis 0.3.3 2026-04-04 [1] CRAN (R 4.6.0)
fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.6.0)
fs 2.1.0 2026-04-18 [1] CRAN (R 4.6.0)
glue 1.8.1 2026-04-17 [1] CRAN (R 4.6.0)
htmltools 0.5.9 2025-12-04 [1] CRAN (R 4.6.0)
httpuv 1.6.17 2026-03-18 [1] CRAN (R 4.6.0)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.6.0)
jsonlite 2.0.0 2025-03-27 [1] CRAN (R 4.6.0)
later 1.4.8 2026-03-05 [1] CRAN (R 4.6.0)
lifecycle 1.0.5 2026-01-08 [1] CRAN (R 4.6.0)
magrittr 2.0.5 2026-04-04 [1] CRAN (R 4.6.0)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.6.0)
mime 0.13 2025-03-17 [1] CRAN (R 4.6.0)
otel 0.2.0 2025-08-29 [1] CRAN (R 4.6.0)
pillar 1.11.1 2025-09-17 [1] CRAN (R 4.6.0)
pkgbuild 1.4.8 2025-05-26 [1] CRAN (R 4.6.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.6.0)
pkgload 1.5.3 2026-06-15 [1] CRAN (R 4.6.1)
promises 1.5.0 2025-11-01 [1] CRAN (R 4.6.0)
purrr 1.2.2 2026-04-10 [1] CRAN (R 4.6.0)
R6 2.6.1 2025-02-15 [1] CRAN (R 4.6.0)
Rcpp 1.1.1-1.1 2026-04-24 [1] CRAN (R 4.6.0)
rlang 1.2.0 2026-04-06 [1] CRAN (R 4.6.0)
rstudioapi 0.18.0 2026-01-16 [1] CRAN (R 4.6.0)
sass 0.4.10 2025-04-11 [1] CRAN (R 4.6.0)
sessioninfo 1.2.4 2026-06-04 [1] CRAN (R 4.6.1)
shiny * 1.10.0 2024-12-14 [1] CRAN (R 4.6.0)
tibble 3.3.1 2026-01-11 [1] CRAN (R 4.6.0)
usethis 3.2.1 2025-09-06 [1] CRAN (R 4.6.1)
vctrs 0.7.3 2026-04-11 [1] CRAN (R 4.6.0)
xtable 1.8-8 2026-02-22 [1] CRAN (R 4.6.0)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied R example using page_navbar() and nav_menu(), then compare its keyboard behavior with the linked Bootstrap navbar example. Trace the navigation entry points involved in opening and leaving the menu; done means keyboard users can move between navbar pages and exit the dropdown without becoming trapped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bootstrap, r
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100