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

Latest release breaks select when tagging and tagging-label="false" are set #1214

Open
karptonite opened this issue Sep 29, 2015 · 22 comments
Open

Comments

@karptonite
Copy link

I don't have a plunker for it yet, but the latest release has broken select for me. Here is a quick video example:
http://quick.as/r2zvin2lb

@karptonite
Copy link
Author

I suspect that the bug is related to this commit:
f6b6d81
activeIndex is no longer being set on mouseover, but appears to be being used.

@dimirc
Copy link
Contributor

dimirc commented Sep 29, 2015

I cannot reproduce it, I tried the multi select demo but when pressing a choice it works correctly, can you setup a plunker or confirm how to reproduce it?

@karptonite
Copy link
Author

I'll see if I can get it on a plunkr tomorrow, if I have time.

@karptonite
Copy link
Author

For now, here is the code for the select that doesn't work:
https://gist.github.com/karptonite/3f72ec9e0f8c0d912d57

@dimirc
Copy link
Contributor

dimirc commented Sep 29, 2015

Can you confirm if force-options-down is a private directive you did or where this comes from?

@karptonite
Copy link
Author

force-options-down is something I did before the position attribute was added (it was equivalent to position="down"). I'm pretty certain it is unrelated to this bug, but I don't have the code in front of me.

@realityking
Copy link

This seeminly also broke the styling for the bootstrap theme, previously the hover effect was a blue background, now it's gray.

@karptonite
Copy link
Author

@dimirc Actually, as @realityking says, you can even see in you multiselect demo that the bootstrap styles are broken in the current release. I suspect if you track down that bug, the bug I see in functionality (but have yet reproduced in a plunker) may be fixed.

@dimirc
Copy link
Contributor

dimirc commented Sep 30, 2015

@realityking @karptonite maybe the confusion here is that with #1211 we removed the ability to set activeIndex on hover and actually only change the background (with css) on hover to give some visual feedback. To change the activeIndex was causing a useless performance hit on hover since the activeIndex was change (and a full $digest). I see more sense on having the current activeIndex change only by the UP/DOWN keys and only a hover effect when mouse over.

@karptonite
Copy link
Author

@dimirc I'm sure that caused the problem, but I'd argue that until it works as before, the performance hit wasn't useless. :) unfortunately, I still haven't had time to reproduce the functional bug I showed in the video, but the problem with the bootstrap theme is out there on the current release, and reproducible in the plunker.

@dimirc
Copy link
Contributor

dimirc commented Oct 1, 2015

@karptonite but what is the problems that is reproducible? Please explain me clearly what is expected and what is now showing so I can fix it if it's actually broken

@karptonite
Copy link
Author

@dimirc OK, while I wasn't able to reproduce the exact problem, what I found is this:
http://plnkr.co/edit/6rLzCvmyNKorQo3CuyhA?p=preview
The new version breaks specifically when tagging is being used, and tagging-label="false".
Selecting any of the existing options in this code with a mouse is impossible (it adds an empty user instead). This code works fine on version 0.12.1.

@karptonite karptonite changed the title Latest release breaks select Latest release breaks select when tagging and tagging-label="false" are set Oct 2, 2015
@ghaiat
Copy link

ghaiat commented Nov 3, 2015

Hello, any update on this? this is still not working
Anyone has a workaround for now?

@karptonite
Copy link
Author

Honestly, my workaround was just not to use tagging-label="false" in my code. That was possible for me because tagging-label="false" was actually a workaround for a previous bug (I don't remember what) that was no longer an issue, as far I could tell. Sorry, not too helpful, but it may work for you, depending on your use case.

@dariusjb
Copy link

dariusjb commented Nov 6, 2015

I only reverted back 2 pieces of code (check f6b6d81 for the whole changelist that produced the issue):

I reverted:
.attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')

and

ctrl.setActiveItem = function(item) {
ctrl.activeIndex = ctrl.items.indexOf(item);
};

Now tagging-label='false' tagging="myAddTagFunction"

works like a charm while before: either you can only select (mouse click) a predefined value and add new tag (using keyboard for selecting was actually working)
or if you remove only the tagging-label attribute, you can no longer add new tag due to init failure that prevent from having the default "(new)" working and predefined value could be again mouse selected as normal.
The demo plunker is showing the issue when the select.js is from the master branch
The demo plunker when using the doc link, is going to a plunker with 0.11 version on. So no bug

@wesleycho
Copy link
Contributor

Can the Plunker be updated with the latest release?

@karptonite
Copy link
Author

I updated the plunker with the latest release, here:
http://plnkr.co/edit/VWvSsKqz4NvRJs1ZHfBK?p=preview

It seems to show the same problem behavior as the previous plunker, however, I didn't look at it to carefully.

@studds
Copy link

studds commented Apr 19, 2016

I'm having this same issue with single select. Both of the single select demos on the official examples page exhibit the issue:

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

(Last two examples. In the example Tagging in Single Select mode you can select existing options but it's impossible to create new options. In the example Tagging in Single select mode, with simple strings there are no existing options and so nothing can be selected.)

@qc00
Copy link

qc00 commented May 25, 2016

A minimal plnkr for this:

http://plnkr.co/edit/oVra6eBaFaLVo1PvM6JL?p=preview

First one tagging and selection works. Second one only tagging works. Mouse click no longer does anything.

The issue seems to be when tagging-label="false", the tagging function is called (with an empty string). The function is not called if tagging-label is not set.

This behaviour still exists in 1.17.1.

@sabliao
Copy link

sabliao commented Jan 18, 2017

Is there any fix/workaround that'll allow for single select tagging? I've tried to look through the issues here, but I feel like I keep running into a scenario where people only show multiple select tagging working or I run into a dead end where some fix didn't actually fix the problem.

EDIT: nevermind, I was able to get a workaround for my particular combo of versions (had previously thought I was already using tagging-label="false", but turns out I was doing something different w/ tagging-label, and setting it to false fixed my issue).

@giacomolicari
Copy link

giacomolicari commented Apr 3, 2017

The issue still persists when tagging and tagging-label="false" are set. Matching items are not highlighted.
ui-select Version: 0.19.5

@giacomolicari
Copy link

giacomolicari commented Apr 4, 2017

the following changes to uiSelectChoicesDirective.js on line 65 solved the issue.

 scope.$watch('$select.search', function(newValue) {
          if(newValue && !$select.open && $select.multiple) $select.activate(false, true);
          $select.activeIndex = 0; // <-- $select.tagging.isActivated ? -1 : 0;
          if (!attrs.minimumInputLength || $select.search.length >= attrs.minimumInputLength) {
            $select.refresh(attrs.refresh);
          } else {
            $select.items = [];
          }
        });

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

10 participants