realcrowd / angularjs-utilities

Hopefully useful directives, providers, filters, etc for AngularJS
Other
199 stars 50 forks source link

make auto focus feature configurable #10

Open twinssbc opened 10 years ago

twinssbc commented 10 years ago

The behavior in rcStep that automatically focus on the first input is a sweet design. But can it be configurable? The issue I meet is in my form, the first element is not an input. Also if my form is very long and my first input is at the bottom of the form, this focus feature will make the page scroll down to the bottom. So each time I enter into this step, I have to first scroll up then fill the info.

      // if a rcStep is being used on the current tab, 
      // automatically focus on the first input of the current tab. This
      // allows for easier keyboard-ony navigation.
      if (steps.length > currentIndex && steps[currentIndex].element) {
        steps[currentIndex].element.find('input').first().focus();
      }