Skip to content

Setting dropdown width to 'initial' expands to the full width #2051

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

Closed
jasongrout opened this issue Apr 16, 2018 · 2 comments
Closed

Setting dropdown width to 'initial' expands to the full width #2051

jasongrout opened this issue Apr 16, 2018 · 2 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@jasongrout
Copy link
Member

jasongrout commented Apr 16, 2018

This expands the dropdown to the full width possible, rather than just sizing to content:

from ipywidgets import *
Dropdown(layout={'width': 'initial'}, options=['very very very very very very very very very very very very very very long option', 'another option'])

It looks like the inner select box has a flex grow attribute:

flex: 1 1 var(--jp-widgets-inline-width-short);
, so it grows to be the full width. Taking off the inner select flex grow makes the content in the above example instead just expand to the width of the content. This is still a slight problem since the dropdown arrow overwrites the last bit of content - perhaps we should add a bit of padding or something to ensure the svg dropdown arrow is to the right of the last bit of content.

Since this changes the layout behavior, I consider this a breaking change for a user, so setting this to be a major release issue.

This issue was found when answering #2050

@jasongrout jasongrout added this to the Major release milestone Apr 16, 2018
@jasongrout
Copy link
Member Author

This is still a slight problem since the dropdown arrow overwrites the last bit of content - perhaps we should add a bit of padding or something to ensure the svg dropdown arrow is to the right of the last bit of content.

This is now: #2052

@jasongrout
Copy link
Member Author

jasongrout commented Jan 14, 2020

Setting to max-content works great, as in #2050. Thanks!

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

1 participant