posit-dev / posit-dev/py-shiny

Inconsistent Popup Window Placement When Using ipydatagrid with pyshiny 0.3.3

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

Nobody has claimed this yet.

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

Description

Issue Description:

I encountered unexpected behavior while attempting to embed an interactive table using ipydatagrid. Specifically, when utilizing pyshiny 0.3.3 and ipywidgets to embed an ipydatagrid widget on my website, the table renders correctly. However, an issue arises when attempting to interact with the table, such as sorting columns or performing other actions. The window that displays the available options appears at the bottom of the site page instead of directly adjacent to the datagrid widget.

Steps to Reproduce:
  1. Install pyshiny version 0.3.3.
  2. Set up a website with ipywidgets support.
  3. Embed an ipydatagrid widget within the website.
  4. Attempt to interact with the embedded datagrid by sorting a column or performing other actions.
  5. Observe that the window displaying options appears at the bottom of the site page instead of next to the datagrid widget.
import numpy as np
from shiny import ui, module
from shinywidgets import render_widget, output_widget
import pandas as pd
from ipydatagrid import DataGrid

df = pd.DataFrame()
df['x'] = np.random.normal(0, 1, 10)
df['y'] = np.random.normal(0, 1, 10)

@module.ui
def bins_ui():
    return ui.tags.div(
        ui.panel_title("Rendering Table using ipydatagrid"),
            ui.panel_main(
                output_widget("table"),
            ),
        )

@module.server
def bins_server(input, output, session):
    @output
    @render_widget
    def table():
        global df
        grid = DataGrid(df)
        return grid
Expected Behavior:

When interacting with the ipydatagrid widget embedded using pyshiny 0.3.3 and ipywidgets, the window displaying available options should appear adjacent to the datagrid widget.

Actual Behavior:

Currently, when attempting to sort columns or perform other actions on the ipydatagrid widget, the window that should display options appears at the bottom of the site page rather than next to the datagrid widget.

Additional Information:

Python version: 3.8.13
ipydatagrid version: 1.1.16
ipywidgets version: 8.0.6
Other relevant libraries and their versions: pandas=2.0.2
Browser: Safari and Microsoft Edge

screenshot

I click at 1, but the popup occurs at 2.

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 reproducing the provided ipydatagrid example with pyshiny 0.3.3, ipywidgets 8.0.6, and the listed browser versions. Trace the widget interaction that opens the sorting options and identify where popup placement is integrated; done means the options appear adjacent to the datagrid rather than at the bottom of the page.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.