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

Panel >=1.2.2 messes out webpage scrolling in the reactive API #6180

Closed
julioasotodv opened this issue Jan 10, 2024 · 2 comments · Fixed by #6666
Closed

Panel >=1.2.2 messes out webpage scrolling in the reactive API #6180

julioasotodv opened this issue Jan 10, 2024 · 2 comments · Fixed by #6666
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@julioasotodv
Copy link

julioasotodv commented Jan 10, 2024

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc)

  • panel>=1.2.2 (it does not happen with previous versions)
  • Any modern version of Firefox, tested from 99.0 to 121.0; also happens in Safari 17.2.1. But it does not happen in Chrome nor Opera for instance

Description of expected behavior and the observed behavior

For some reason, using a widget that modifies some pane is making the browser's scrollbar go directly to the widget location; changing user's viewport in a Panel app

Complete, minimal, self-contained example code that reproduces the issue

We can create a file called test.py:

import random

import panel as pn
pn.extension()

import matplotlib
import matplotlib.pyplot as plt

# Reactive function for pn.bind:
def plot_points(n):
    x = [random.uniform(0, 10) for i in range(n)]
    y = [random.uniform(0, 10) for i in range(n)]
    fig = plt.Figure()
    ax = fig.add_subplot()
    ax.scatter(x, y)
    return pn.pane.Matplotlib(fig, 
                              width=500,
                              tight=True)

# Widget:
selector_n = pn.widgets.IntSlider(start=2, end=100)

# We put both the widget and the chart in a column.
# I also include a tall Spacer to make the app tall enough
# to be scrollable:
app = pn.Column(pn.Spacer(width=300, height=3000, styles={"background":'#BCA600'}),
                selector_n, 
                pn.bind(plot_points, n=selector_n))
app.servable()

Which we can run with:

panel serve test.py

Stack traceback and/or browser JavaScript console output

No warnings nor error tracebacks appear in any web browser's console

Screenshots or screencasts of the bug in action

You can see the weird behavior in the following GIF:

test_bug_panel

Thank you!

@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Jan 10, 2024
@philippjfr philippjfr added this to the v1.3.7 milestone Jan 10, 2024
@philippjfr philippjfr modified the milestones: v1.3.7, v1.4.0 Jan 19, 2024
@JulienLrx
Copy link

Same problem here for panel >= 1.2.2 on all browser i've tested so far (latest chrome, edge, firefox and opera)

@philippjfr philippjfr modified the milestones: v1.4.0, v1.4.x Mar 13, 2024
@philippjfr
Copy link
Member

Seems very annoying, I indeed was not able to reproduce in Chrome but Firefox and Safari were affected. Investigating with the profiling indicates this happens immediately after the slider is updated and not when the matplotlib plot is redrawn which was what I had expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants