bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

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

Open krisurnok opened this issue 11 years ago • 3 comments

  $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 avatar Aug 21 '15 07:08 krisurnok

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.

wesleycho avatar Aug 23 '15 13:08 wesleycho

Can you give any alternative solution for this please

krisurnok avatar Aug 31 '15 08:08 krisurnok

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.

wesleycho avatar Aug 31 '15 12:08 wesleycho