bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

Right control of carousel is broken

Open JsLth opened this issue 2 years ago • 0 comments

When clicking on the right arrow of a bs4Dash::carousel, the page jumps down, but the carousel is not triggered. The left arrow works as expected. You can view a live demonstration of this on the demo server.

I think the issue here is that for the right button, href and data-target are set incorrectly. From useful-items.R#L382, with added comments:

shiny::tagList(
  # previous
  shiny::tags$a(
    class = "carousel-control-prev",
   `data-target` = paste0("#", id),
    href = "#",
    role = "button",
    `data-slide` = "prev",
    shiny::tags$span(
      class = "carousel-control-prev-icon",
      `aria-hidden` = "true"
    ),
    shiny::tags$span(class = "sr-only", "Previous")
  ),
  # next
  shiny::tags$a(
    class = "carousel-control-next",
    # This is where `data-target` should be set
    # `data-target` = paste0("#", id),
    # href = "#",
    href = paste0("#", id), # this is the value that should be set for data-target
    role = "button",
    `data-slide` = "next",
    shiny::tags$span(
      class = "carousel-control-next-icon",
      `aria-hidden` = "true"
    ),
    shiny::tags$span(class = "sr-only", "Next")
  )
)

JsLth avatar Sep 11 '23 10:09 JsLth