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

Scroll to selected items - bugfix when using with animate #1742

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

Conversation

karas111
Copy link

No description provided.

@@ -144,6 +144,11 @@ uis.controller('uiSelectCtrl',

if (ctrl.items.length > 0) {
ctrl.$animate.on('enter', container[0], animateHandler);
$timeout(function () {
Copy link
Contributor

@user378230 user378230 Aug 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't (or couldn't) this be done in animateHandler?

@user378230
Copy link
Contributor

user378230 commented Aug 11, 2016

I feel like there is some duplication here as we already have:

      if (ctrl.$animate && ctrl.$animate.on && ctrl.$animate.enabled(container[0])) {
       ...
      } else {
        $timeout(function () {
          ctrl.focusSearchInput(initSearchValue);
          if(!ctrl.tagging.isActivated && ctrl.items.length > 1) {
            _ensureHighlightVisible();
          }
        });
      }

And animateHandler already calls ctrl.focusSearchInput(..).

The timeout call should be extracted to a helper function which is called appropriately, rather than having it separated out.

@sonphnt
Copy link

sonphnt commented Aug 24, 2016

This one fixed the problem with scroll to current selected item. But the scrolling position is not very perfect to GUI. I think it should scroll selected item in the middle between top and bottom of the menu-dropdown.

Now it either is at the top or at the bottom.

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

Successfully merging this pull request may close these issues.

3 participants