3 * A Backbone View that provides keyboard interaction for a contextual link.
6 (function (Drupal, Backbone) {
10 Drupal.contextual.KeyboardView = Backbone.View.extend(/** @lends Drupal.contextual.KeyboardView# */{
16 'focus .trigger': 'focus',
17 'focus .contextual-links a': 'focus',
18 'blur .trigger': function () { this.model.blur(); },
19 'blur .contextual-links a': function () {
20 // Set up a timeout to allow a user to tab between the trigger and the
21 // contextual links without the menu dismissing.
23 this.timer = window.setTimeout(function () {
24 that.model.close().blur();
30 * Provides keyboard interaction for a contextual link.
34 * @augments Backbone.View
36 initialize: function () {
39 * The timer is used to create a delay before dismissing the contextual
40 * links on blur. This is only necessary when keyboard users tab into
41 * contextual links without edit mode (i.e. without TabbingManager).
42 * That means that if we decide to disable tabbing of contextual links
43 * without edit mode, all this timer logic can go away.
51 * Sets focus on the model; Clears the timer that dismisses the links.
54 // Clear the timeout that might have been set by blurring a link.
55 window.clearTimeout(this.timer);