ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

No overflow at the top level in JupyterLab

Open jasongrout opened this issue 4 years ago • 4 comments
trafficstars

Description

The top-level widget box should scroll so you can see the overflow.

I think this may be the underlying issue for https://github.com/jupyterlab/jupyterlab/issues/10763

Reproduce

On current master, execute:

HBox(layout=dict(width="2000px", height="50px", border="3px solid red"))

Note that in JupyterLab (3.1) you cannot scroll to see the full box:

Screen Shot 2021-08-06 at 5 13 25 PM

This is becaue the top-level jp-OutputArea-output div has the jupyter-widgets class, which masks its overflow:auto with overflow:visible:

Screen Shot 2021-08-06 at 5 14 51 PM

I think recently we added the jupyter-widgets class to this top-level element, but I can't find the issue nor where in the code it happens right now.

Expected behavior

That jp-OutputArea-output div should have overflow: auto, and quite possibly should not have the jupyter-widgets class applied.

Context

  • ipywidgets version current master on JLab 3.1
  • Operating System and version: macOS Catalina
  • Browser and version: Firefox

jasongrout avatar Aug 07 '21 00:08 jasongrout

The solution to this should probably be backported to 7.x.

jasongrout avatar Aug 07 '21 00:08 jasongrout

@jasongrout I can't reproduce this anymore. Will discuss on our call tomorrow!

ibdafna avatar Sep 07 '21 06:09 ibdafna

Hi @jasongrout @ibdafna, after spending a bit too long on master trying to trace code to find where the jupyter-widgets CSS class was added, I found out this was fixed a couple years ago in #2500, but no official releases have been published since then. I've tried ipywidgets==8.0.0b0 as well as dev-install.sh with #2500 cherry-picked on ipywidgets==7.6.5, and for both horizontal overflow scrollbars appear for horizontally long widgets.

I think the following are duplicates of this issue: #2499 #2778 #2842 #3184 #3322 #3412

Since this is a blocking issue for a lot of users (myself included, since for example this prevents using widgets showing pandas.DataFrames with a lot of columns), could we backport this to a new release ipywidgets==7.6.x / jupyterlab_widgets==1.0.x? For me personally, I'd prefer not to use ipywidgets==8.x currently to maintain compatibility with kernels of venvs with ipywidgets==7.x installed (and also since its still in beta), and this bug currently exists for all versions of ipywidgets that are compatible with jupyterlab >= 3.0. Thanks in advance.

azjps avatar Dec 03 '21 05:12 azjps

In case this helps anyone wanting to do a local install:

# create tmp venv w/ yarn for dev build
conda create -p /tmp/venv-widgets -c conda-forge python=3.8 yarn jupyterlab=3.2.3
conda activate /tmp/venv-widgets

git clone https://github.com/jupyter-widgets/ipywidgets && cd ipywidgets
git checkout 7.6.5
git cherry-pick 57eca692c445148cf54c7a9d05bfbf2c389b091c  # https://github.com/jupyter-widgets/ipywidgets/pull/2500
# optional: bump ipywidgets/_version.py & jupyterlab_widgets/jupyterlab_widgets/_version.py
bash -x ./dev-install.sh
python setup.py bdist_wheel  # build ipywidgets wheel, maybe unnecessary
cd jupyterlab_widgets && python setup.py bdist_wheel  # build jupyterlab_widgets wheel

# Install wheel to venv to use
conda activate my_env
pip install {path to}/ipywidgets/dist/ipywidgets-7.6.*.whl {path to}/ipywidgets/jupyterlab_widgets/dist/jupyterlab_widgets-1.0.*.whl 

azjps avatar Dec 03 '21 11:12 azjps