Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Input Width not 100% #533

Open
erslater opened this issue Dec 18, 2014 · 42 comments
Open

Input Width not 100% #533

erslater opened this issue Dec 18, 2014 · 42 comments

Comments

@erslater
Copy link

I have a multi select inside a bootstrap tab page and the search input is only 10px wide when it first displays.

beforefocus

After clicking on the tab that the multi select appears on the width will expand to 100% once focus is placed on any of the controls in the form.

afterfocus

@PowerKiKi
Copy link

Same symptoms here, anything happened since then ?

@havenchyk
Copy link

@erslater, could you provide demo?

@PowerKiKi
Copy link

Here is a Plunker updated to latest versions of everything and demonstrating the issue: http://plnkr.co/edit/f6o1hxq1Yymc7Vv2oMHb?p=preview

As you can see removing ngAnimate avoid the issue. Unfortunately this is probably not an acceptable solution for real-world cases.

@rywhee
Copy link

rywhee commented Feb 19, 2015

Having the same issue here....

For now, in my scenario, was able to hack around the problem by tweaking the positioning of related elements. Of course the ui-select-container needs a height...

  .select2-choices {
    position: relative;
  }
  .ui-select-multiple input.ui-select-search {
    width: 100% !important;
    position: absolute;
  }

@TroodoNmike
Copy link

i have the same issue. Small hack from rwhee solved problem for me (for now..)

@ma-zal
Copy link

ma-zal commented Jun 29, 2015

Same isssue. But my workaround is:

.ui-select-multiple input.ui-select-search:not(.ng-touched) {
    width: 100% !important;
}

@macem
Copy link

macem commented Jul 22, 2015

This solution not working when we have short select and long text selected because we don't have space to click and add another item.

I prefer to add width: inherit !important and add plus icon for input

@silentHoo
Copy link

Same problem here, but for now @macem's solution works

@arbaaz
Copy link

arbaaz commented Aug 11, 2015

Same problem here.

@cdjackson
Copy link
Contributor

Possible duplicate of #1111

@jziggas
Copy link

jziggas commented Oct 28, 2015

I ran into the same problem while using ui-select inside of a table, inside of angular-ui's Bootstrap tabs. Fixed it by adding a select="tabSelected()" callback to the tab element with $scope.tabSelected = function() { $scope.$applyAsync(); }; in the controller.

@colinbes
Copy link

Similar to @rywhee I ended up with a CSS based solution. Mine is a little different due to what I assume to be difference in attr/class naming with different ui-select versions.

I am using ui-select 0.13.2 together with Bootstrap 3's modal.

I included a ".modal" to limit this 'fix' to only ui-select's within a bootstrap modal window.

I also included a min height for ui-select-multiple as due to absolute setting on child (ui-select-search) it had no height.

.modal .ui-select-multiple.ui-select-bootstrap {
  position: relative;
  min-height:29px;
}
.modal .ui-select-multiple input.ui-select-search {
  width: 100% !important;
  position: absolute;
}

@Mobiletainment
Copy link

+1 for @ma-zal's solution. Thank you

@ilaipi
Copy link

ilaipi commented Jan 12, 2016

why this is still a bug?

@verjik
Copy link

verjik commented Jan 27, 2016

+1 on Version 0.14.0

@fatihkizmaz
Copy link

+1 for @ma-zal

@bestconsultant
Copy link

+1 on 0.14.2

@hitigon
Copy link

hitigon commented Feb 9, 2016

+1

@benitezhm
Copy link

+1 on 0.14.9

@sergonius
Copy link

The width is broken, for me it is always 100%.

@mtr
Copy link

mtr commented Apr 12, 2016

I experience the same error both with @PowerKiKi's plunker, where the input size in Tab 2 is always 10px until it been focused.

I experience the same problem using the current (fe0c0c1) master version of ui-select.

@txtbits
Copy link

txtbits commented Apr 26, 2016

+1 to @mtr
If you put ui-select inside not active tab, the input.ui-select-search starts with width:10px; inline until it been focused.
(tested at 0.16.1)

@ronaldohoch
Copy link

Same bug, but this works fine to me:

.form-group .ui-select-container .select2-choices .select2-search-field, .form-group .ui-select-container .select2-choices .select2-search-field input{width:100%!important;}

@yang-zhang-syd
Copy link

I have the same problem. When I resize the browser the width of ui select changed to 10px. The following works for me.

input.ui-select-search {
width: 100% !important;
}

@madmis
Copy link

madmis commented Jun 2, 2016

+1 - version 0.17.1

@tikijian
Copy link

tikijian commented Jun 2, 2016

+1
style="width: 10px;"
for some reason

@jkevingutierrez
Copy link

jkevingutierrez commented Jun 9, 2016

+1 on 0.17.1

@hcape
Copy link

hcape commented Jun 9, 2016

+1 0.17.1
I have 3 multiple select fields. The 3rd one is disabled until the 1st one is filled in. Bars 1 and 2 have 100% width as expected, but when bar 3 becomes enabled the width is 10px.

@fruzsii
Copy link

fruzsii commented Jun 10, 2016

+1 0.17.1

@Jevonius
Copy link

Jevonius commented Jun 15, 2016

This sounds like a duplicate of #1617 (and probably others) which was fixed in the latest commit in dist; it's effectively version 0.17.2, but the version number wasn't bumped - check the date element. The version I'm using is:
Version: 0.17.1 - 2016-06-09T20:41:58.363Z as of 7ab5f17

I've just tried this, updating the plunkr above, but it's still not working, so appears to be a different issue. Sorry for the confusion!

@rdrscan
Copy link

rdrscan commented Jun 29, 2016

+1 0.18.0

@woolf864
Copy link

there is another solution:

ui-select(multiple='', ng-model=data.bind, theme='bootstrap' ng-class="{ 'empty-select': data.bind.empty }")

and in css:

.empty-select input.ui-select-search {
  width: 100% !important;
}

in this solution input does'not have 100% width for all the time

@saumil11
Copy link

@ma-zal workaround did the trick for me. Thanks 👍

@Scukerman
Copy link

Scukerman commented Oct 24, 2016

better fix here:

.ui-select-multiple.ui-select-bootstrap.ui-select-container.ng-empty input.ui-select-search { width: 100% !important; }

P.S. Version: 0.19.5

@AndreevskiAleksandar
Copy link

+1
Version: 0.19.6
@Scukerman workaround did the trick for me.

@bartvanremortele
Copy link

All of the fixes suggested here cause a different issue where the input is being pushed to the next line when updating the model from outside of the component.
schermafbeelding 2017-03-27 om 12 52 17

@AndreevskiAleksandar
Copy link

@bartvanremortele I had the same issue. Dived into the code a bit and found out that the ui-select watches the ng-disabled parameter and updates the search input width.
Just make the ui-select disabled that enable it again after 1ms (just set up a $timeout function with 1ms execution time or no parameter at all).
This is not a solution but a small workaround for now. I still hope that there will be some onItemChange or some method that will expose the re-computing of the inputs size.

@fosron
Copy link

fosron commented Apr 25, 2017

@AndreevskiAleksandar Still have the same problem as @bartvanremortele and it won't fix with your solution. Even the documentation http://angular-ui.github.io/ui-select/demo-multiple-selection.html is broken.

@keeprock
Copy link

@AndreevskiAleksandar your solution + css one make it work for me. Thanks!

@tproenza
Copy link

@keeprock where did it work for you to apply the disable true/false? Thanks in advance!

@colinbes
Copy link

This thread seems to be related to pretty old version, I assume you're using latest version?

With latest version I no longer have issue stated in this thread but do have another issue with has been brought up in PR #2045

@Galacticjo28
Copy link

Is anyone still experiencing this bug, I am using version 0.19.8 and had to use the css workaround setting the ui-select-search width to 100% !important

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

No branches or pull requests