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

select2 4.0 - dropdownAutoWidth not working #3101

Closed
santaclaus21 opened this issue Mar 3, 2015 · 9 comments
Closed

select2 4.0 - dropdownAutoWidth not working #3101

santaclaus21 opened this issue Mar 3, 2015 · 9 comments

Comments

@santaclaus21
Copy link

option dropdownAutoWidth is not working in 4.0. It's important in my case...

@kevin-brown
Copy link
Member

Merging into #3419.

@kvikram1988
Copy link

Is this fix available as part of 4.0.0 release. When will we get it into any further release???

@kevin-brown
Copy link
Member

Unfortunately that other ticket was closed off as being a different issue, so I'm reopening this one temporarily. dropdownAutoWidth was added back in time for 4.0.0 (this commit: e416e47).


Can you expand upon the issue you are facing by adding a few more pieces of information to your bug report?

  • What steps can be used to reproduce the issue?
  • What is the bug and what is the expected outcome?
  • What browser(s) and Operating System have you tested with?
  • Does the bug happen consistently across all tested browsers?
  • What version of jQuery are you using? And what version of Select2?
  • Are you using Select2 with other plugins?

The contributing guide contains a useful section with a few questions which can help us track down the bug and speed up the process of finding a fix for it. The creation of an isolated test case would also be useful.

@santaclaus21
Copy link
Author

This is still not working in 4.0.1 (even using full version).

{width: 'resolve', theme: 'classic', dropdownAutoWidth: 'true'}
image

in 3.5.2 looks good:
image

@G4g4Rm3L
Copy link

G4g4Rm3L commented Dec 8, 2015

I have the same problem. It works for me if I add "css.position = 'relative';" at line 4246 (select2.full.js / 4.0.1)

    if (this.options.get('dropdownAutoWidth')) {
      css.minWidth = css.width;
      css.width = 'auto';
      css.position = 'relative';
    }

@santaclaus21
Copy link
Author

As @G4g4Rm3L said, should be added "css.position = 'relative';" at if (this.options.get('dropdownAutoWidth')). Without this change option not working for me.

not working example on jsfiddle:
https://jsfiddle.net/wphqwvLf/120/

@joetidee
Copy link

Please re-open. Still has issues with not auto-sizing to the container of the select2:

https://jsfiddle.net/fbz0mngp/4/

@santaclaus21
Copy link
Author

Hm... https://jsfiddle.net/fbz0mngp/7/. It looks fine for me (?)

@joetidee
Copy link

joetidee commented Sep 19, 2016

In this example, would you not expect the select to act responsively and shrink down to fill the right-most div (make sure you select the long answer from the list) ?:

https://jsfiddle.net/fbz0mngp/17/

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

No branches or pull requests

5 participants