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

Chosen not styling properly in a bootstrap 3.x dialog. #2822

Closed
lordspace opened this issue May 31, 2017 · 6 comments
Closed

Chosen not styling properly in a bootstrap 3.x dialog. #2822

lordspace opened this issue May 31, 2017 · 6 comments

Comments

@lordspace
Copy link

Summarize your issue here.
Chosen not styling properly in a bootstrap 3.x dialog.

Steps to reproduce

load bootstrap's css
load load a dialog.
open the dialog

Additionally, please link to a working demo that shows the issue so we can attempt to reproduce. You can use this template as a base. Alternatively, confirm that the Chosen demo page shows the issue.

Expected behavior

to show the nicely styled & searchable dropdown

Actual behavior

here you go
image

Environment

  • Chosen Version:
    chosen_v1.6.2/

  • jQuery or Prototype Version:
    /jquery/1.11.2/jquery.min.js'

  • Browser and Version:
    Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0

  • OS and Version:
    windows 10

Additional information

n/a

@tjschuck
Copy link
Member

Chosen 1.6.2 is not the latest version — do you still have your issue on the latest released version?

@lordspace
Copy link
Author

I will make sure I have it and let you know.

@lordspace
Copy link
Author

lordspace commented Jun 5, 2017

Yes, the problem is still there even in latest 1.7 version.

I checked some stackoverflow topics and came up with this fix.

$('.modal').filter('[class*=_dialog]').on('show.bs.modal', function () {
                // This makes the dialog expand when shown in a bootstrap dlg
                $(this).find('.chosen-container').css({width: "100%"});
            });

The app is custom and for a client and can't provide a link to it.

@lordspace
Copy link
Author

Ok, just to add an update on this.
When I pass the width at the initialization method all works without the hack above.

$("select").chosen({
                search_contains : true, // kwd can be anywhere
                max_selected_options: 1,
                max_shown_results : 5, // show only 5 suggestions at a time
                width: "95%",
                no_results_text: "Oops, nothing found!"
            } );

@pihug12
Copy link

pihug12 commented Aug 21, 2017

Thanks for the hack @lordspace. It took me quite some time to find your fix.

I'm not sure why this issue was closed in the "bootstrap-chosen" repo (alxlit/bootstrap-chosen#54).

@lordspace
Copy link
Author

No worries. Maybe I closed it assuming that it's not a bug if it's fixable via options but when I think about it now it should work out of the box.

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

3 participants