setDepth

caph.focus.focusController. setDepth

Sets the current focusable depth if the given value is different from current value. If the current focus item exists, it will be blurred. And then, finds a proper next focus item and focuses it. If there was a previously focused item in the new depth, it will be next focus item. Otherwise searches for a initial focus item from the new depth and then uses it to next focus item.

(static) setDepth(depth, groupopt, useHistoryopt) → {caph.focus.focusController}

Parameters:
Name Type Attributes Description
depth number

A number to be set.

group string <optional>

A group to be set. If not passed, use the initial focus group of the given depth. If there is no initial focus group, use default group.

useHistory boolean <optional>

A boolean determines whether searches for a focusable element from the focus change history in advance. Default value is true.

Returns:
Type
caph.focus.focusController
Example
angular.module('myApp', ['caph.focus']).controller('myController', ['$scope', 'focusController', function($scope, focusController) {
 	$scope.changeDepth = function(depth) {
 		focusController.setDepth(depth);
 	}
 }]);