Skip to content

Panning Plotly plot or Leaflet map in Shiny absolutePanel also moves panel #3752

Closed

Description

@AlexWaterboyBezzina

Hi Shiny people,
First off just wanted to say absolutely incredible package it makes may life so much easier! Second I have run into this issue with interactive outputs inside absolute panels, such as leaflet maps or plotly plots, where when you try to pan, zoom or drag. The output loses most of its interactive features. I have also noticed if you set the interactive panel to fixed the mouse position is off to the left from where the mouse image actually appears when you try and hover over specific areas on the plot or map.

Plotly Example:

library(plotly)
library(shiny)

shinyApp(
  ui = fluidPage(
    absolutePanel(draggable=T, width='600px', wellPanel(
      fluidRow(plotlyOutput('plot'))
    ))
  ),
  server = function(input, output, session) {
    output$plot=renderPlotly({
      plot_ly(data=mtcars, type='scatter', mode='markers', x=~hp, y=~mpg, name=~cyl)
    })
  }
)

Leaflet Example:

library(leaflet)
library(shiny)

shinyApp(
  ui = fluidPage(
    absolutePanel(draggable=T, width='600px', wellPanel(
      fluidRow(leafletOutput('map'))
    ))
  ),
  server = function(input, output, session) {
    output$map=renderLeaflet({
      leaflet() %>%
        addProviderTiles(providers$OpenStreetMap)
    }) 
  }
)

Is there someway to perhaps remove the draggability for specific areas of the panel?

Any help would be greatly appreciated :)

Activity

  1. added 2 commits that reference this issue on Oct 31, 2023
    7600835
    bdfcefc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions