yalabot / angular-foundation

http://pineconellc.github.io/angular-foundation/
Other
1.05k stars 266 forks source link

Keyboard navigation issue while scrolling up-down #305

Open alpeshkumarpr opened 8 years ago

alpeshkumarpr commented 8 years ago

Hello,

We find an issue for scrolling up & down the lists available in dropdown while navigating through keyboard. Solution is found in the question below and it works for us.

http://stackoverflow.com/questions/27705490/up-down-arrow-key-issue-with-typeahead-control-angular-bootstrap-ui

Solution:

Add below code in mm-foundation-typeahead.js. file.


.directive('shouldFocus', function(){ </br>
  return {
   restrict: 'A',
   link: function(scope,element,attrs){
     scope.$watch(attrs.shouldFocus,function(newVal,oldVal){
       if (newVal) {
         element[0].scrollIntoView(false);
       }
     });
   }
 };
})

and add attribute with li element named should-focus="isActive($index)" in typeahead-popup.html.

Looking forward to incorporate this change asap.

Thanks.