Skip to content

use inherit for width when offsetWidth is 0 #2495

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

koenpunt
Copy link
Collaborator

@koenpunt koenpunt commented Jan 4, 2016

This to accommodate for times the Chosen select is initially hidden, as is the case in bootstrap modals and panels

To verify this, checkout this branch; inherit-width, build using grunt, open public/index.html and run the following in the developer console

$('.chosen-select').first().chosen('destroy')
  .parent().hide()
  .find('select').chosen()
  .parent().show()

Thanks to @pierre-alain-b for this solution!

fixes #92
fixes #1272
fixes #1329
fixes #2309

cc: @pfiller @tjschuck @stof

this to accommodate for times the chosen select is initially hidden, as is the case in bootstrap modals and panels
@tjschuck
Copy link
Member

tjschuck commented Jan 4, 2016

@koenpunt Why inherit instead of 100%?

@tjschuck
Copy link
Member

tjschuck commented Jan 4, 2016

Specifically, if the parent's width is defined as a percentage, this would inherit the percentage, making Chosen have the width of percentage-of-percentage instead of the actual width of the parent.

@koenpunt
Copy link
Collaborator Author

koenpunt commented Jan 5, 2016

Hm, did not yet try it with a parent which has the width set to a percentage.

@AbeyMarquez
Copy link

I have a chosen inside a modal. I rendered chosen before the modal was shown. In my case, having 'initial' here causes the chosen to have a smaller width than it should... It doesn't fill a bootstrap column fully. If I do 'auto' instead of 'initial' it works perfectly.

@JJJ JJJ mentioned this pull request Jul 23, 2020
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

Successfully merging this pull request may close these issues.

if select is initially hidden, doesn't work Select in a div that's hidden on page load Bootstrap Modal
4 participants