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

Mouseenter (selection) doesn't work in 1.2.16+ using IE8 #158

Closed
sambomartin opened this issue Aug 12, 2014 · 11 comments
Closed

Mouseenter (selection) doesn't work in 1.2.16+ using IE8 #158

sambomartin opened this issue Aug 12, 2014 · 11 comments

Comments

@sambomartin
Copy link

On mouseenter the selected item moves to the last one. The mouseover event fires for each row in the collection - always leaving the last one selected.

Current work-around is to use 1.2.15.

@sambomartin sambomartin changed the title Mouseover selection doesn't work in 1.2.16+ using IE8 Mouseenter (selection) doesn't work in 1.2.16+ using IE8 Aug 12, 2014
@gillius
Copy link

gillius commented Sep 22, 2014

I don't know if my issue is related or not, but I can't get the select to work on IE8 for any version later than 0.2.1. This is the last version that works in IE8 that I can test. I have to use Angular 1.2.16 with this because of the bug that was fixed with ng-transclude. What happens to me is that I click on an element and it doesn't actually select anything. After I click on the first element, then it seems to actually select that one but then I get a ng-change event for what seems to be every single element in the list, which blows up my application.

I tried angular-ui-select 0.7.0 with Angular 1.2.16, but it doesn't work (doesn't display content inside of the templates, so dropdown is empty), so I can't isolate the selection issue between Angular upgrade and angular-ui-select upgrade.

@gillius
Copy link

gillius commented Sep 22, 2014

I think my issue is different, I do see it's always setting the last item active. It's actually the ng-click that isn't working, and I'm not sure why, maybe the a's href for javascript:void(0) is eating the event somehow, not sure.

I actually can 95% workaround the issues by adding my own ng-click and ng-mouseenter events myself to the transcluded content. The issue is that there are wrapper elements around them, like the a tag, which has visible space surrounding the parts that I can control. The fact that I can work-around this is sort of surprising.

scope.selItem = function($select, $event, item) {
    $event.stopPropagation();
    //do work with item, as I would with ng-change
    $select.select(loc); //needed to make the dropdown disappear
}
<ui-select-choices ng-mouseenter="$event.stopPropagation()" repeat="item in items | filter: $select.search">
    <div render-item="item" ng-click="selLoc($select, $event, item)" ng-mouseenter="$event.stopPropagation()"></div>
</ui-select-choices>

@careywalker
Copy link

I am not fully sure why the below worked but adding the ng-mouseenter and ng-click events to the rowsInner instead of the choices solved this issue in IE8 for me. I'll continue to look into why this works and post back when I can confirm the reason this resolves this issue.

Existing Code:

      choices.attr('ng-repeat', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, groupByExp))
          .attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')')
          .attr('ng-click', '$select.select(' + $select.parserResult.itemName + ')');

      var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
      if (rowsInner.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row-inner but got '{0}'.", rowsInner.length);
      rowsInner.attr('uis-transclude-append', ''); //Adding uisTranscludeAppend directive to row element after choices element has ngRepeat

Code after I made the changes:

      choices.attr('ng-repeat', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, groupByExp));


      var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
      if (rowsInner.length !== 1) throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row-inner but got '{0}'.", rowsInner.length);
      rowsInner.attr('uis-transclude-append', '')
          .attr('ng-mouseenter', '$select.setActiveItem(' + $select.parserResult.itemName + ')')
          .attr('ng-click', '$select.select(' + $select.parserResult.itemName + ')');//Adding uisTranscludeAppend directive to row element after choices element has ngRepeat

@wiciul
Copy link

wiciul commented Nov 13, 2014

Changes I have applied to 0.8.3 in order to make it work with IE8.
selectui01
selectui02
selectui03

jlfama pushed a commit to jlfama/ui-select that referenced this issue Nov 19, 2014
@jonathanchris
Copy link

Any chance this will get added to a release?

@milkolori
Copy link

I had the same issue. This fix worked for me. It will be great if it is included in some future release.

@jonathanchris
Copy link

I created a pull request with the event delegation fixes from @jlfama fork. The indexOf issues can be fixed by including an ie8 shim.

@amcdnl
Copy link
Contributor

amcdnl commented Dec 9, 2014

Eh, I think most of us are on 1.3 ( which drops IE8 support ) ... maybe maintain a separate branch for IE8'ers?

brianhubbell added a commit to DynamicVisionInc/ui-select that referenced this issue Feb 20, 2015
brianhubbell added a commit to DynamicVisionInc/ui-select that referenced this issue Feb 20, 2015
brianhubbell added a commit to DynamicVisionInc/ui-select that referenced this issue Feb 20, 2015
@Josh68
Copy link
Contributor

Josh68 commented Mar 11, 2015

@careywalker, your code (minor modification based on version) worked for me with 0.9.6.

(EDIT) This would apply cleanly also to the latest version (v0.11.1) -- no merge conflicts. Would it be worth trying another pull request on the current version? I also haven't taken time to see why it fixes the issue in IE8, but it doesn't break anything for me, in my project, in latest IE, Chrome, or FF.

Josh68 added a commit to Josh68/ui-select that referenced this issue Mar 12, 2015
angular-ui#158, based on an observed (but maybe not well understood) code change by @careywalker. Basically, just move the ng-click/ng-mouseenter bindings from the LI (choices-row) to the contained DIV (choices-row-inner). So far, I haven't seen an affect on behavior in any browser, but this is with light manual testing.

All automated tests pass with these changes in place:

>gulp test
[15:05:36] Using gulpfile C:\web\sites\ui-select\gulpfile.js
[15:05:36] Starting 'clean'...
[15:05:36] Finished 'clean' after 14 ms
[15:05:36] Starting 'scripts'...
[15:05:36] Starting 'styles'...
[15:05:36] Finished 'styles' after 61 ms
[15:05:37] Finished 'scripts' after 1.01 s
[15:05:37] Starting 'build'...
[15:05:37] Finished 'build' after 14 μs
[15:05:37] Starting 'karma'...
[15:05:38] Finished 'karma' after 880 ms
[15:05:38] Starting 'test'...
[15:05:38] Finished 'test' after 5.63 μs
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 41.0.2272 (Windows 7)]: Connected on socket gaw3nxxZW2Omee4BBX-X with id 17666700
Chrome 41.0.2272 (Windows 7): Executed 110 of 110 SUCCESS (2.483 secs / 2.465 secs)
@gillius
Copy link

gillius commented Jun 12, 2015

#754 seems to work for me. We have no choice to support IE8 and IE11 now during a enterprise migration to IE11, and Angular 1.2.16 has a bug impacting IE11, but upgrading beyond select 0.2 doesn't work in IE8, and it doesn't work in Angular past 1.2.16. So now we will use @Josh68's code with Angular 1.2.28, the last Angular version supporting IE8. Once the IE8 merge is complete, we can upgrade to latest Angular and mainline ui-select.

@alexey-yurganov
Copy link

Josh68@8317a0c
This fixed for me follow issue IE 8:
"On mouseenter the selected item moves to the last one. The mouseover event fires for each row in the collection - always leaving the last one selected."

angular js 1.2.28
select.js 0.11.1 from https://github.com/Josh68/ui-select

Thank you.

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

9 participants