Removes ability to enter accessibility mode using shift click (#3538)

* Removes ability to enter accessibility mode using shift click
This commit is contained in:
alschmiedt
2020-01-03 11:21:42 -08:00
committed by GitHub
parent f06d7b3cfd
commit bfa6fa6581
2 changed files with 8 additions and 7 deletions

View File

@@ -496,8 +496,9 @@ Blockly.Gesture.prototype.doStart = function(e) {
Blockly.Tooltip.block();
if (this.targetBlock_) {
if (!this.targetBlock_.isInFlyout && e.shiftKey) {
Blockly.navigation.enableKeyboardAccessibility();
if (!this.targetBlock_.isInFlyout &&
e.shiftKey &&
this.targetBlock_.workspace.keyboardAccessibilityMode) {
this.creatorWorkspace_.getCursor().setCurNode(
Blockly.navigation.getTopNode(this.targetBlock_));
} else {
@@ -765,8 +766,7 @@ Blockly.Gesture.prototype.doBlockClick_ = function() {
*/
Blockly.Gesture.prototype.doWorkspaceClick_ = function(e) {
var ws = this.creatorWorkspace_;
if (e.shiftKey) {
Blockly.navigation.enableKeyboardAccessibility();
if (e.shiftKey && ws.keyboardAccessibilityMode) {
var screenCoord = new Blockly.utils.Coordinate(e.clientX, e.clientY);
var wsCoord = Blockly.utils.screenToWsCoordinates(ws, screenCoord);
var wsNode = Blockly.ASTNode.createWorkspaceNode(ws, wsCoord);

View File

@@ -89,9 +89,10 @@ suite('Gesture', function() {
};
var ws = Blockly.inject('blocklyDiv', {});
var gesture = new Blockly.Gesture(this.e, ws);
assertFalse(ws.keyboardAccessibilityMode);
ws.keyboardAccessibilityMode = true;
var gesture = new Blockly.Gesture(event, ws);
gesture.doWorkspaceClick_(event);
assertTrue(ws.keyboardAccessibilityMode);
var cursor = ws.getCursor();
assertEquals(cursor.getCurNode().getType(), Blockly.ASTNode.types.WORKSPACE);
});
});