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

skipFocusser option (disable refocussing) #869

Closed
deje1011 opened this issue Apr 21, 2015 · 0 comments
Closed

skipFocusser option (disable refocussing) #869

deje1011 opened this issue Apr 21, 2015 · 0 comments

Comments

@deje1011
Copy link

Hello Wladimir,

we are using the the ui-select component inside of a table in combination with other controls. It works great, so thank you for your work! However there is one feature that does not match our concept. I guess in general it makes sense to refocus the control if no other input or ui-select-control was clicked. The problem is that most of our controls do not have an input field before you click on them.

Is it possible to add an option that allows us to do either set "skipFocusser" to be true or add class names to the "focusableControls"-array ourselves?

Line 864, Version 0.11.2

function onDocumentClick(e) {
  if (!$select.open) return; 
  var contains = false;
  if (window.jQuery) {
    contains = window.jQuery.contains(element[0], e.target);
  } else {
    contains = element[0].contains(e.target);
  }

  if (!contains && !$select.clickTriggeredSelect) {
    var focusableControls = ['input','button','textarea'];  // Adding class names here would be great
    var targetScope = angular.element(e.target).scope(); 
    var skipFocusser = targetScope && targetScope.$select && targetScope.$select !== $select;
    if (!skipFocusser) skipFocusser =  ~focusableControls.indexOf(e.target.tagName.toLowerCase()); 
    $select.close(skipFocusser); // setting skipFocusser to be true by passing an option would also be nice 
    scope.$digest();
  }
  $select.clickTriggeredSelect = false;
}

Looking forward to your response,
Jesse

aaronroberson added a commit that referenced this issue Mar 15, 2016
feat(skipFocuser): add skip focusser option

Add a skipFocusser option to configure skipping the focusser after selecting an item.

Closes #869 #401 #818 #603 #432
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

1 participant