mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Fix interaction between mouse and keyboard (#3070)
This commit is contained in:
@@ -663,6 +663,9 @@ Blockly.Gesture.prototype.handleWsStart = function(e, ws) {
|
||||
this.setStartWorkspace_(ws);
|
||||
this.mostRecentEvent_ = e;
|
||||
this.doStart(e);
|
||||
if (Blockly.keyboardAccessibilityMode) {
|
||||
Blockly.navigation.setState(Blockly.navigation.STATE_WS);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,6 +107,15 @@ Blockly.navigation.removeMark_ = function() {
|
||||
Blockly.getMainWorkspace().getMarker().hide();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the current navigation state.
|
||||
* @param {number} newState The new navigation state.
|
||||
* @package
|
||||
*/
|
||||
Blockly.navigation.setState = function(newState) {
|
||||
Blockly.navigation.currentState_ = newState;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the top node on a block.
|
||||
* This is either the previous connection, output connection or the block.
|
||||
@@ -133,20 +142,23 @@ Blockly.navigation.getTopNode = function(block) {
|
||||
/************************/
|
||||
|
||||
/**
|
||||
* Set the state to the toolbox state and the current category as the first
|
||||
* If a toolbox exists, set the navigation state to toolbox and select the first
|
||||
* category in the toolbox.
|
||||
* category.
|
||||
* @private
|
||||
*/
|
||||
Blockly.navigation.focusToolbox_ = function() {
|
||||
Blockly.navigation.resetFlyout_(false /* shouldHide */);
|
||||
Blockly.navigation.currentState_ = Blockly.navigation.STATE_TOOLBOX;
|
||||
var workspace = Blockly.getMainWorkspace();
|
||||
var toolbox = workspace.getToolbox();
|
||||
if (toolbox) {
|
||||
Blockly.navigation.currentState_ = Blockly.navigation.STATE_TOOLBOX;
|
||||
Blockly.navigation.resetFlyout_(false /* shouldHide */);
|
||||
|
||||
if (!Blockly.getMainWorkspace().getMarker().getCurNode()) {
|
||||
Blockly.navigation.markAtCursor_();
|
||||
if (!Blockly.getMainWorkspace().getMarker().getCurNode()) {
|
||||
Blockly.navigation.markAtCursor_();
|
||||
}
|
||||
toolbox.selectFirstCategory();
|
||||
}
|
||||
toolbox.selectFirstCategory();
|
||||
};
|
||||
|
||||
/***********************/
|
||||
|
||||
@@ -260,9 +260,15 @@ Blockly.Toolbox.prototype.handleAfterTreeSelected_ = function(
|
||||
if (this.lastCategory_ != newNode) {
|
||||
this.flyout_.scrollToStart();
|
||||
}
|
||||
if (Blockly.keyboardAccessibilityMode) {
|
||||
Blockly.navigation.setState(Blockly.navigation.STATE_TOOLBOX);
|
||||
}
|
||||
} else {
|
||||
// Hide the flyout.
|
||||
this.flyout_.hide();
|
||||
if (Blockly.keyboardAccessibilityMode) {
|
||||
Blockly.navigation.setState(Blockly.navigation.STATE_WS);
|
||||
}
|
||||
}
|
||||
if (oldNode != newNode && oldNode != this) {
|
||||
var event = new Blockly.Events.Ui(null, 'category',
|
||||
|
||||
Reference in New Issue
Block a user