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

[datepicker] date is selected by enter key, tab index focusing window ,so i modified some changes in code #4244

Closed
krisurnok opened this issue Aug 21, 2015 · 3 comments

Comments

@krisurnok
Copy link

  $scope.keydown = function( evt ) {
    var key = $scope.keys[evt.which];

    if ( !key || evt.shiftKey || evt.altKey ) {
      return;
    }

    evt.preventDefault();
    if(!self.shortcutPropagation){
        evt.stopPropagation();
    }

    if (key === 'enter' || key === 'space') {
      if ( self.isDisabled(self.activeDate)) {
        return; // do nothing
      }
      $scope.select(self.activeDate);
      focusElement();
    } else if (evt.ctrlKey && (key === 'up' || key === 'down')) {
      $scope.toggleMode(key === 'up' ? 1 : -1);
      focusElement();
    } else {
      self.handleKeyDown(key, evt);
      self.refreshView();
    }
  };
}])

/**************************************/

$scope.select(self.activeDate);
focusElement();

after changing the code it working ,i have mention the code below
/**************************************/

$scope.select(self.activeDate);
self.element[0].parentElement.parentElement.parentElement.previousElementSibling.focus();

please review the code and give your comments,please

@krisurnok krisurnok changed the title datepicker: date is selected by enter key,after tab focus missing to next element datepicker: date is selected by enter key, tab index focusing window ,so i modified some changes in code Aug 22, 2015
@krisurnok krisurnok changed the title datepicker: date is selected by enter key, tab index focusing window ,so i modified some changes in code [datepicker] date is selected by enter key, tab index focusing window ,so i modified some changes in code Aug 22, 2015
@wesleycho
Copy link
Contributor

We do not want to do anything like

self.element[0].parentElement.parentElement.parentElement.previousElementSibling.focus();

This is an antipattern, and is tied too heavily to DOM structure.

If you are proposing a modification, please file a pull request - it is difficult to do a code review otherwise.

@krisurnok
Copy link
Author

Can you give any alternative solution for this please

@wesleycho
Copy link
Contributor

https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md#you-think-youve-found-a-bug - the minimum bar has not been met for anyone to even tackle this, since the problem is not well-defined.

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

2 participants