Option to disable cursor keyboard navigation on treelist widgets

pull/198/head
Thomas Bruederli 11 years ago
parent fc90c3a7ac
commit 6c647deffc

@ -45,6 +45,7 @@ function rcube_treelist_widget(node, p)
scroll_step: 5, scroll_step: 5,
scroll_speed: 20, scroll_speed: 20,
save_state: false, save_state: false,
keyboard: true,
check_droptarget: function(node){ return !node.virtual } check_droptarget: function(node){ return !node.virtual }
}, p || {}); }, p || {});
@ -735,7 +736,7 @@ function rcube_treelist_widget(node, p)
case 40: case 40:
case 63232: // 'up', in safari keypress case 63232: // 'up', in safari keypress
case 63233: // 'down', in safari keypress case 63233: // 'down', in safari keypress
var li = container.find(':focus').closest('li'); var li = p.keyboard ? container.find(':focus').closest('li') : [];
if (li.length) { if (li.length) {
focus_next(li, (mod = keyCode == 38 || keyCode == 63232 ? -1 : 1)); focus_next(li, (mod = keyCode == 38 || keyCode == 63232 ? -1 : 1));
} }
@ -753,9 +754,11 @@ function rcube_treelist_widget(node, p)
return false; return false;
case 9: // Tab case 9: // Tab
if (p.keyboard) {
// jump to last/first item to move focus away from the treelist widget by tab // jump to last/first item to move focus away from the treelist widget by tab
var limit = rcube_event.get_modifier(e) == SHIFT_KEY ? 'first' : 'last'; var limit = rcube_event.get_modifier(e) == SHIFT_KEY ? 'first' : 'last';
focus_noscroll(container.find('li[role=treeitem]:has(a)')[limit]().find('a:'+limit)); focus_noscroll(container.find('li[role=treeitem]:has(a)')[limit]().find('a:'+limit));
}
break; break;
} }

Loading…
Cancel
Save