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

Bug - select width are incorrect when resizing #1678

Open
hmillet opened this issue Jun 22, 2016 · 7 comments
Open

Bug - select width are incorrect when resizing #1678

hmillet opened this issue Jun 22, 2016 · 7 comments

Comments

@hmillet
Copy link

hmillet commented Jun 22, 2016

Bug description:

When you open a page with a "ui-select", all is fine. But if you resize your window, and then you want to open a select, the div shown has not the correct size. Sometimes very small, sometines huge

Link to minimally-working plunker that reproduces the issue:

Simply http://angular-ui.github.io/ui-select/demo-bootstrap.html

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Your own demo, with google chrome

Screenshot

2016-06-22 18_40_32-angularjs ui-select

@guilhermemsilva
Copy link

guilhermemsilva commented Jun 22, 2016

This problem theoretically have been resolved in pull request #1631.

But this problem still occurs to me aswell, as I replied in the issue #880, take a look there if you can.

@hmillet
Copy link
Author

hmillet commented Jun 22, 2016

@guilhermemsilva thanks for answer, I will take a look at #880

@guilhermemsilva
Copy link

I have an easier solution, that worked for me:

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

@benjaminapetersen
Copy link

Continue to see this issue as well.

@hmillet
Copy link
Author

hmillet commented Jul 9, 2016

I've just tested the @guilhermemsilva workaround.
This works for me. So thanks a lot for that 👍

But I still waiting for a real fix.

MarkDeMaria added a commit to MarkDeMaria/origin-web-console that referenced this issue Jul 11, 2016
Fix style

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
-Add leading padding left of ui-select-match
-Fix width hang issue (see angular-ui/ui-select#1678
MarkDeMaria pushed a commit to MarkDeMaria/origin-web-console that referenced this issue Jul 11, 2016
-Add UI select tag that populates on load but starts only the first
-Terminals are connected to only on selection
-Terminal statuses are maintained and shown via the dropdown as (connected disconnected, not in use)

This is the 2nd commit message:

Fix style

-Terminal status floated right
-No icons
-No status given in the dropdown on the active terminal

Fix style

-Add leading padding left of ui-select-match
-Fix width hang issue (see angular-ui/ui-select#1678
@davidsalamon
Copy link

@guilhermemsilva workaround produces the following results when using multiple select:
screen shot 2016-09-16 at 14 17 49
Basically the empty area that's supposed to be clickable becomes 100% width and thus, when at least one item is selected, the item's pill pushes the click area to the second row (see caret just below the pill)

@qkang07
Copy link

qkang07 commented Jan 19, 2017

same problem.
I have another scenario, the text box is 10px shorter when resized:
image
I can find the source code which caused all these problem, but I can't understand the purpose.

ctrl.sizeSearchInput = function() {

    var input = ctrl.searchInput[0],
        container = ctrl.searchInput.parent().parent()[0],
        calculateContainerWidth = function() {
          // Return the container width only if the search input is visible
          return container.clientWidth * !!input.offsetParent;
        },
        updateIfVisible = function(containerWidth) {
          if (containerWidth === 0) {
            return false;
          }
          var inputWidth = containerWidth - input.offsetLeft - 10;
          if (inputWidth < 50) inputWidth = containerWidth;
          ctrl.searchInput.css('width', inputWidth+'px');
          return true;
        };

    ctrl.searchInput.css('width', '10px');
    $timeout(function() { //Give tags time to render correctly
      if (sizeWatch === null && !updateIfVisible(calculateContainerWidth())) {
        sizeWatch = $scope.$watch(function() {
          if (!updaterScheduled) {
            updaterScheduled = true;
            $scope.$$postDigest(function() {
              updaterScheduled = false;
              if (updateIfVisible(calculateContainerWidth())) {
                sizeWatch();
                sizeWatch = null;
              }
            });
          }
        }, angular.noop);
      }
    });
  };

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

No branches or pull requests

5 participants