From 9a6a92bf52d748bd36c82250e9c023a0084e550e Mon Sep 17 00:00:00 2001 From: kozbial Date: Tue, 20 Jul 2021 16:47:25 -0700 Subject: [PATCH] Migrate core/keyboard_nav/tab_navigate_cursor.js named requires --- core/keyboard_nav/tab_navigate_cursor.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/core/keyboard_nav/tab_navigate_cursor.js b/core/keyboard_nav/tab_navigate_cursor.js index ad2bb45ba..37f90fe37 100644 --- a/core/keyboard_nav/tab_navigate_cursor.js +++ b/core/keyboard_nav/tab_navigate_cursor.js @@ -14,26 +14,25 @@ goog.module('Blockly.TabNavigateCursor'); goog.module.declareLegacyNamespace(); -goog.require('Blockly.ASTNode'); -goog.require('Blockly.BasicCursor'); -goog.require('Blockly.utils.object'); - -goog.requireType('Blockly.Field'); +const ASTNode = goog.require('Blockly.ASTNode'); +const BasicCursor = goog.require('Blockly.BasicCursor'); +const Field = goog.requireType('Blockly.Field'); +const {inherits} = goog.require('Blockly.utils.object'); /** * A cursor for navigating between tab navigable fields. * @constructor - * @extends {Blockly.BasicCursor} + * @extends {BasicCursor} */ const TabNavigateCursor = function() { TabNavigateCursor.superClass_.constructor.call(this); }; -Blockly.utils.object.inherits(TabNavigateCursor, Blockly.BasicCursor); +inherits(TabNavigateCursor, BasicCursor); /** * Skip all nodes except for tab navigable fields. - * @param {Blockly.ASTNode} node The AST node to check whether it is valid. + * @param {?ASTNode} node The AST node to check whether it is valid. * @return {boolean} True if the node should be visited, false otherwise. * @override */ @@ -41,8 +40,8 @@ TabNavigateCursor.prototype.validNode_ = function(node) { let isValid = false; const type = node && node.getType(); if (node) { - const location = /** @type {Blockly.Field} */ (node.getLocation()); - if (type == Blockly.ASTNode.types.FIELD && + const location = /** @type {Field} */ (node.getLocation()); + if (type == ASTNode.types.FIELD && location && location.isTabNavigable() && location.isClickable()) { isValid = true; }