3 * A Backbone View that provides keyboard interaction for a contextual link.
6 (function (Drupal, Backbone) {
7 Drupal.contextual.KeyboardView = Backbone.View.extend(/** @lends Drupal.contextual.KeyboardView# */{
13 'focus .trigger': 'focus',
14 'focus .contextual-links a': 'focus',
15 'blur .trigger': function () {
18 'blur .contextual-links a': function () {
19 // Set up a timeout to allow a user to tab between the trigger and the
20 // contextual links without the menu dismissing.
22 this.timer = window.setTimeout(() => {
23 that.model.close().blur();
29 * Provides keyboard interaction for a contextual link.
33 * @augments Backbone.View
37 * The timer is used to create a delay before dismissing the contextual
38 * links on blur. This is only necessary when keyboard users tab into
39 * contextual links without edit mode (i.e. without TabbingManager).
40 * That means that if we decide to disable tabbing of contextual links
41 * without edit mode, all this timer logic can go away.
49 * Sets focus on the model; Clears the timer that dismisses the links.
52 // Clear the timeout that might have been set by blurring a link.
53 window.clearTimeout(this.timer);