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

Layout options not applied to Tab widgets outside of JupyterLab context #3934

Open
benelliott opened this issue Aug 19, 2024 · 0 comments
Open

Comments

@benelliott
Copy link

benelliott commented Aug 19, 2024

Description

Hi,

I am trying to implement a custom front-end for a Jupyter kernel session, based on the HTML Manager library and taking cues from the web examples in this repo. However, I have found that widget layouts that involve Tab don't seem to work quite as well as they do when rendering inside JupyterLab.

Reproduce

Here is some example code (reduced from a more complex real-world case):

import ipywidgets as widgets
from ipywidgets import Layout


tab = widgets.Tab(layout=Layout(flex='1'))
widgets.HBox([tab], layout=Layout(width='100%'))

When this is executed inside JupyterLab, the rendered result correctly applies the flex: 1 attribute to the tab element, so that the tab widget can occupy the full width of the HBox:

image

When running this outside JupyterLab, such as in my custom front-end, in a simple setup with the HTML Manager AMD template, or via this repo's web3 example, this inline style attribute is not applied to the tab:

image

(Note that the parent HBox's 100% width is applied correctly in both cases)

Expected behavior

It should be possible to apply Layout options to the Tab widget in any environment.

Context

I tried to debug this a little myself, but didn't get that far. It seems like the LayoutModel gets created correctly for both the HBox and the Tab, but I don't think setLayout is called on the outer tab container for some reason. What stumps me is why this works OK in JupyterLab.

Apologies if this is due to user error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant