posit-dev / posit-dev/py-shiny

Clicking `Browse...` on an `ui.input_file()` causes the window to scroll to the top

Open
#701 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

Shinylive app link

Reprex app code:

from shiny import App, render, ui
from htmltools import TagList

app_ui = ui.page_fluid(
    ui.h3("Scroll down to upload a file"),
    *[TagList(i, ui.br()) for i in range(100)],
    "(Clicking on `Browse...` causes the window to scroll back up!)",
    ui.input_file("file", "File Input"),
    ui.output_text_verbatim("txt"),
)


def server(input, output, session):
    @output
    @render.text
    def txt():
        return f"input.file(): `{input.file()}`"


app = App(app_ui, server)

https://github.com/rstudio/py-shiny/assets/93231/0b1730a8-4cfb-4095-a3ef-561a7e288d63

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Shinylive app or the Python reprex and reproduce the scroll jump when clicking Browse... on ui.input_file(). Trace the file-input UI behavior from there; done means opening the file chooser no longer scrolls the window to the top.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.